[omniORB] Callback loop stallling

Kevin Bailey noone@nowhere.com
Wed, 25 Oct 2000 13:05:20 -0700


I'm having trouble with a test of a callback client that I've
written. The client sits in a loop which makes two method calls
to a server. The server makes a call back to the client in the
second method call.

void Client::callback()
{
  cout << "hi" << endl;
}

void run_test()
{
  try
  {
    Server_var server = ...
    
    while (1)
    {
      server->Function1();
      
      server->Function2(); // calls back to client
      
      // omni_thread::sleep(0, 100000000);
    }
  }
  catch (CORBA::Exception& ex)
  {
    cerr << "CORBA exception: " << ex << endl;
  }
}

The loop gradually slows down and eventually stops after about
933-937 cycles. It stops with the server waiting for the client
callback to respond. When it dies, the client says:

omniORB: ERROR -- A servant has been deleted that is still activated.
    id: root<0>
CORBA exception: COMM_FAILURESegmentation fault (core dumped)

The server never crashes. It is fairly straightforward. It
registers the object that the client calls with the name
service, calls poa_manager->activate() and orb->run().

Both client and server put their objects into the root POA.

The client is a little more complicated. It has to spawn a
thread to run the test loop while leaving the main thread
for orb->run(). I do that like this:

    // (in main)
    
    omni_thread* p_ot = new omni_thread(run_test, 0);
    
    p_ot->start();
    
    cout << "Main thread: starting ORB" << endl;
    // I intentionally let the original thread run this.
    // Many operating systems require it.
    orb->run();

When it dies, there are about 900 ports still in the TIME_WAIT
state. If I re-start the client before they go away (as far as
I can tell), it immediately spits out the error above. If I
wait a while, it'll run through another 933-937 times.

If I remove the callback back to the client, it runs "forever".

If I put a 10ms delay (omni_thread::sleep) in the loop,
it'll run 937 times, stop for about a half second, then
resume. Longer delays cause it to run "forever".

Any ideas what's happening ? Am I just running through ports
too fast ? I thought omniORB would re-use open ports. Would
that cause the error message above ?

I'd appreciate any suggestion to help figure out what's
wrong.

P.S. Return address is bogus, please reply to list.