[omniORB] Single thread hanging...

Duncan Grisby duncan@grisby.org
Fri Sep 6 16:05:02 2002


On Thursday 5 September, Marcus MacWilliam wrote:

> I initialise my own server POA to have SINGLE_THREAD_MODEL
> as its thread policy, all the others are as the "RootPOA".
> 
> OK, the problem is when I pass a CORBA object as a parameter to
> a method, and attempt to call a method on the passed object. The server
> just freezes. (This works fine on NT).

The problem is that omniORB 3 implements the single thread model by
locking an omni_mutex. A reentrant call deadlocks against itself. This
is perfectly compliant according to CORBA 2.3, which omniORB 3
implements. You get away with it on NT because the mutex
implementation happens to be recursive by accident.

omniORB 4 explicitly implements and uses a recursive mutex, as
required by a later version of the CORBA spec (I can't remember
exactly which version it was added in), so you won't have that problem
there.

The single thread model is still evil, though, and you can still
deadlock against yourself if you call out of your address space and
that call calls back in to you. (Before someone suggests using a
reactor model, notice that that can't tell if it's the same logical
thread of control doing a reentrant call, and thus fails the single
thread semantics.)

I would strongly recommend everyone to stay away from the single
thread model (and the even more evil main thread model available in
omniORB 4), and implement your own concurrency control.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --