Sending messages to ones self

John (J5) Palmieri johnp at redhat.com
Tue Jun 7 13:08:53 PDT 2005


On Tue, 2005-06-07 at 15:24 -0400, John (J5) Palmieri wrote:
> This currently only works if you send an async message.  If you block in
> the same thread you are screwed and your program deadlocks.  How do we
> handle this?  Do we worry about it for 1.0 or try to detect that the
> message is being routed to ones self and throw an error?

Talking out loud here.  Hopefully someone will either back this up or
come up with a better solution.  The way it works now is that if you
call yourself and block the message still gets queued up but not
propagated to the service's handler because while we are blocking we
only check if the pending call has returned.  What happens is after the
pending call times out the message is then propagated to the handler
who's reply gets lost because we are no longer listening to the pending
call.  So we deadlock for as long as the timeout is set for.

I think this is fine as programmer always have to work with these issues
and should know if a call can be routed back to itself in which case
they can set up threads or use async methods.  In other words we just
define the operation of calling into ones self while blocking as having
an undefined result (the same as we do for calling an overloaded method
without specifying an interface).  There is the same issue with a
service making a blocking call to another service which then in turn
makes a blocking call to the first service within the handler.  I think
trying to special case it just opens up a can of worms.  Opinions?

   
-- 
John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.
Blog: http://martianrock.com



More information about the dbus mailing list