[omniORB] locking questions
Lars Immisch
lars@ibp.de
Sat, 17 Mar 2001 14:56:01 +0100
Hi Duncan,
> 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.
Oh yes, I had thought about that, but that isn't too bad, because there is
only two places in my code where multiple requests are sent and I can send them
without locks held. But there are many places scattered around the code where
just a single request is sent - and in quite a few of these places the decision
whether to send the message is determined by internal state that needs to be
protected - and this is awkward to implement.
Thanks,
- Lars