[omniORB] Race condition between Scavenger thread startup and ORB shutdown

Peter Klotz Peter.Klotz at ith-icoserve.com
Tue Feb 17 11:22:59 GMT 2015


> It seems that AsyncInvoker does not yet see the Scavenger thread and performs
> its shutdown. Most probably this happens because pd_lock is held during
> AsyncInvoker destruction which prevents Scavenger from being started. As soon
> as the AsyncInvoker destructor gives up the mutex, Scavenger can continue.
> Since pd_pool is a member of AsyncInvoker, the access of Scavenger results in
> a crash.

The problem can easily be triggered by adding an artificial delay. Calling "omni_thread::sleep(0,50);" at the beginning of omniAsyncWorker::run() crashes a simple client test program executed in a while-loop in less than a minute.


The attached patch ensures that the Scavenger thread enters its execute() method before Scavenger::notify() is left. Therefore it is guaranteed that AsyncInvoker sees the Scavenger thread prior to its own destruction and will wait for it. The overhead of waiting for the Scavenger thread startup is negligible.

Regards, Peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omniORB-4.2.0-Scavenger.patch
Type: application/octet-stream
Size: 1852 bytes
Desc: omniORB-4.2.0-Scavenger.patch
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20150217/026ff247/attachment.obj>


More information about the omniORB-list mailing list