[omniORB] locking questions

Duncan Grisby dgrisby@uk.research.att.com
Thu, 15 Mar 2001 15:21:35 +0000


On Thursday 15 March, David Riddoch wrote:
> On Thu, 15 Mar 2001, Lars Immisch wrote:

[...]
> > But this would be a source of potential deadlocks if omniORB held any
> > mutexes while calling my code. My reading of the omniORB code indicates
> > that omniORB will hold no mutex when calling my code (unless I am using a
> > single threaded POA).
> > 
> > Is this correct?
> 
> Yes.

Although if you're not careful, you can still manage to deadlock
against yourself, even using oneways.

Imagine two machines, A and B. A thread on A is holding a lock. It
fires off an enormous number of oneway requests to B, while still
holding the lock. The implementation of the first oneway on B does a
callback to an object on A. That callback operation blocks trying to
acquire the lock held by the first thread.

B is now unable to service any more of the incoming oneway requests,
since the thread looking after that TCP connection is waiting for the
callback to A to complete. If the TCP buffers fill up, you get a
deadlock.

That's an extremely contrived situation, so it's very unlikely you'd
have to worry about it in practice.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --