[omniORB] Deadlock: got stuck in omniORB::run()

Wernke zur Borg wernke.zur.borg at vega.de
Mon Feb 26 11:34:52 GMT 2007


Hello,

I am having a problem getting stuck in a deadlock while trying to shut
down the ORB. The omniORB version is 4.0.6.

I am using MAIN_THREAD_MODEL with a dedicated undetached omnithread that
handles all upcalls. I call omniORB::setMainThread() then omniORB::run()
from that thread at startup. This works fine, all upcalls are dispatched
on this main thread. (Question: Is there a possibility to wait for
upcalls other than calling omniORB::run() ?)

When it comes to shut down the process, I call omniORB::shutdown() from
another thread and expect omniORB::run() to return in the omniORB
thread. This works in 99 out of 100 cases but every once in a while
run() does not return. Inspection of the stack shows that the thread is
waiting on a condvar named orb_signal, and that a shutdown thread is
hanging in omni::omniObjAdapter::wait_for_detached_objects(). 

Waiting for run() to return is necessary because I have to perform
cleanup activities from that thread, this is a limitation of a 3rd party
database I am using.

This is the stack of the shutdown thread:

  [1] cond_wait(0xfbf05d98, 0x0, 0x0, 0xfdd6c000, 0x0, 0x0), at
0xfdd481ac
  [2] _ti_pthread_cond_wait(0xff337480, 0xff337460, 0xff337460,
0xff3dc890, 0x0, 0x1), at 0xfdd48070
  [3] omni_condition::wait(this = ???) (optimized), at 0xff372154 (line
~163) in "posix.cc"
=>[4] omni::omniObjAdapter::wait_for_detached_objects(this = ???)
(optimized), at 0xff23ab9c (line ~512) in "objectAdapter.cc"
  [5] omni::omniOrbPOA::do_destroy(this = ???, etherealize_objects =
???) (optimized), at 0xff2564dc (line ~2219) in "poa.cc"
  [6] omni::omniOrbPOA::destroy(this = ???, etherealize_objects = ???,
wait_for_completion = ???) (optimized), at 0xff251890 (line ~793) in
"poa.cc"
  [7] omni::omniOrbPOA::do_destroy(this = ???, etherealize_objects =
???) (optimized), at 0xff256288 (line ~2219) in "poa.cc"
  [8] omni::omniOrbPOA::destroy(this = ???, etherealize_objects = ???,
wait_for_completion = ???) (optimized), at 0xff251890 (line ~793) in
"poa.cc"
  [9] omni::omniOrbPOA::shutdown() (optimized), at 0xff25ac18 (line
~3959) in "poa.cc"
  [10] omniOrbORB::actual_shutdown(this = ???) (optimized), at
0xff21283c (line ~1017) in "corbaOrb.cc"
  [11] shutdown_thread_fn(arg = ???) (optimized), at 0xff212904 (line
~1029) in "corbaOrb.cc"
  [12] omni_thread_wrapper(ptr = ???) (optimized), at 0xff372878 (line
~461) in "posix.cc"

This is the stack of my main thread:

  [1] cond_wait(0xfca03d98, 0x0, 0x0, 0xfdd6c000, 0x0, 0x0), at
0xfdd481ac
  [2] _ti_pthread_cond_wait(0xff335308, 0xff3352c8, 0xff3352c8, 0x2,
0xc5050, 0x10c9980), at 0xfdd48070
  [3] omni_condition::wait(this = ???) (optimized), at 0xff372154 (line
~163) in "posix.cc"
  [4] omni::ORBAsyncInvoker::perform(this = ???, secs = ???, nanosecs =
???) (optimized), at 0xff212d50 (line ~1138) in "corbaOrb.cc"
=>[5] omniOrbORB::run(this = ???) (optimized), at 0xff211c4c (line ~811)
in "corbaOrb.cc"
  [6] DatabaseAgent::DatabaseThread::run_undetached(this = 0x1134460,
args = 0x11241f8), line 287 in "DatabaseAgent.C"
  [7] omni_thread_wrapper(ptr = ???) (optimized), at 0xff3728ec (line
~461) in "posix.cc"

Has anybody got an idea why this is and how I can prevent it?

Thanks, Wernke



More information about the omniORB-list mailing list