[omniORB] deadlock during shutdown after client timed out

baileyk@schneider.com baileyk@schneider.com
Tue Oct 22 16:25:01 2002


omniORB 4.0.0, Python 2.2.1, Solaris 8, Sun C++ 5.3.

I have a simple testcase using Python which appears to cause a deadlock
during shutdown if a client times out a call.

Here's the IDL

module ex_proto
{
   interface A {
      long foo( in long p );
   };
};

############# Here's the server code

#!/bin/env python

import ex_proto__POA,ex_proto,CORBA, time, sys

class A( ex_proto__POA.A ) :
   def foo(self, p) : time.sleep(p); return 1

if __name__ == "__main__":
   orb = CORBA.ORB_init(sys.argv)
   poa = orb.resolve_initial_references("RootPOA")
   poa._get_the_POAManager().activate()
   co = A()._this()
   f = open("ior.txt","w")
   f.write( orb.object_to_string( co ) )
   f.close()
   try:
      orb.run()
   except:
      print "shutting down"
      orb.shutdown(0)
      orb.destroy()



################# And the client

#!/bin/env python

import CORBA, ex_proto, sys, time

orb = CORBA.ORB_init(sys.argv)
ior = open("ior.txt","r").read()
a = orb.string_to_object( ior )._narrow( ex_proto.A )

p = int( len(sys.argv) > 1 and sys.argv[1] or 10 )
print "first call"; a.foo( p ); print "done"

time.sleep(p)

print "second call"; a.foo( p ); print "done"



I stop the server with ctrl-C which appears to cause orb.run() to result in
a clean shutdown.  However, if I run the client with a timeout which is
longer than the sleep duration, the server appears to hang.  Interesting
stack traces are below (taken after waiting a few minutes for graceful
shutdown).

Running the client like
$ client 5
runs nicely, and the server shuts down nicely.  But running the client like
$ client -ORBclientCallTimeOutPeriod 2000 5
results in a TRANSIENT (timeout) exception which is expected, but now the
server won't shutdown nicely anymore in response to a ctrl-C.

Any suggestions?

Thanks,
Kendall Bailey

stack traces:
current thread: t@1
  [1] _lwp_sema_wait(0xdffa0, 0x0, 0x0, 0x0, 0x0, 0x2), at 0xfee9b3dc
  [2] _park(0xdffa0, 0xff26e000, 0x0, 0xdfee8, 0x250c4, 0xfe705d78), at
0xff249774
  [3] _swtch(0xdfee8, 0x0, 0xff26e000, 0x5, 0x1000, 0xff26e000), at
0xff24944c
  [4] _cond_timedwait_cancel(0xdfee8, 0x3db56b6f, 0x3a43e, 0xff26e000, 0x0,
0xe7d97ea), at 0xff247b70
  [5] _pthread_cond_timedwait(0xfe3aa170, 0xfe3aa130, 0xffbee9a0, 0x0,
0xfecf48d4, 0x0), at 0xff24792c
  [6] omni_condition::timedwait(0xfe3aa168, 0x3db56b70, 0xe7d97ea, 0x2c00,
0x2f4c, 0x3000), at 0xfece21f8
  [7] omni::ORBAsyncInvoker::perform(0x12e770, 0x3db56b70, 0xe7d97ea, 0x0,
0x0, 0x0), at 0xfe291454
  [8] omniOrbORB::run_timeout(0x130490, 0x3db56b70, 0xe7d97ea, 0xfe291384,
0x2400, 0x26e8), at 0xfe290504
  [9] pyORB_run_timeout(0x0, 0xb4, 0xfedab7dc, 0xfed93538, 0xfb70c, 0x0),
at 0xfed5aaac
  [10] eval_frame(0xfb5a8, 0x0, 0x0, 0x167450, 0x0, 0x2), at 0x4553c
  [11] PyEval_EvalCodeEx(0x0, 0x3, 0xfb5a8, 0xf35cc, 0x0, 0x0), at 0x46c78
  [12] fast_function(0x184d68, 0xffbeecf8, 0x1, 0x1, 0x0, 0x1), at 0x48208
  [13] eval_frame(0xf3480, 0x0, 0x0, 0x130990, 0x0, 0x1), at 0x45690
  [14] PyEval_EvalCodeEx(0x0, 0x0, 0xf3480, 0x0, 0x0, 0x0), at 0x46c78
  [15] PyEval_EvalCode(0x1354b0, 0xf19d8, 0xf19d8, 0xf1, 0x0, 0xe09f0), at
0x41784
  [16] run_node(0xe04c8, 0xffbef12f, 0xf19d8, 0xf19d8, 0xffbeef1c, 0x1), at
0x62a50
  [17] PyRun_SimpleFileExFlags(0xdfd90, 0xffbef12f, 0x1, 0xffbeef1c, 0x1,
0x1), at 0x61abc
  [18] Py_Main(0x2, 0xffbeef84, 0xffbeef90, 0x0, 0xdfd90, 0xdfc00), at
0x1ba48

current thread: t@4
  [1] _cond_timedwait_cancel(0xfea0bd78, 0x3db56b52, 0xc0e0e, 0xff26e000,
0x0, 0x2f16e426), at 0xff247b70
  [2] _pthread_cond_timedwait(0x1c4248, 0xe06a8, 0xfea0bc18, 0x0,
0xfecf48d4, 0x0), at 0xff24792c
  [3] omni_condition::timedwait(0x1c4240, 0x3db56b70, 0x2f16e426, 0x0, 0x0,
0x2f16e426), at 0xfece21f8
  [4] omnipyThreadScavenger::run_undetached(0x1c41e8, 0xfedaffe0, 0x1c4240,
0xfedaeec4, 0x1c41e8, 0xfed9a587), at 0xfed82fe4
  [5] omni_thread_wrapper(0x1c41e8, 0xfecf44b0, 0x0, 0x5, 0x1, 0xfe401000),
at 0xfece28dc

current thread: t@7
  [1] _lwp_sema_wait(0xfe705e30, 0x0, 0x0, 0x0, 0x0, 0x2), at 0xfee9b3dc
  [2] _park(0xfe705e30, 0xff26e000, 0x0, 0xfe705d78, 0x250c4, 0xdfee8), at
0xff249774
  [3] _swtch(0xfe705d78, 0x0, 0xff26e000, 0x5, 0x1000, 0xff26e000), at
0xff24944c
  [4] _cond_timedwait_cancel(0xfe705d78, 0x3db56b6f, 0x35556, 0xff26e000,
0x0, 0xd054dd7), at 0xff247b70
  [5] _pthread_cond_timedwait(0xe0670, 0xe0648, 0xfe705a78, 0x0,
0xfecf48d4, 0x0), at 0xff24792c
  [6] omni_condition::timedwait(0xe0668, 0x3db56b74, 0xd054dd7, 0x0, 0x0,
0xd054dd7), at 0xfece21f8
  [7] omni::Scavenger::execute(0x1bcfb8, 0x2800, 0x2b44, 0x2400, 0x0,
0xfe380702), at 0xfe2f86bc
  [8] omniAsyncWorker::real_run(0x1c8660, 0x1bcfb8, 0x0, 0xfe3ae504,
0xfe2f8608, 0x0), at 0xfe2aefc8
  [9] omniAsyncWorkerInfo::run(0xfe705cac, 0x1c8660, 0xffffffff,
0xff270270, 0x8, 0x139439), at 0xfe2ae4c8
  [10] omniAsyncWorker::run(0x1c8660, 0x0, 0xff26e000, 0x0, 0x1c8660, 0x0),
at 0xfe2af1b8
  [11] omni_thread_wrapper(0x1c8660, 0xfecf44b0, 0x0, 0x5, 0x1,
0xfe401000), at 0xfece28bc