Sending messages to ones self
Waldo Bastian
bastian at kde.org
Wed Jun 8 04:45:35 PDT 2005
On Tuesday 07 June 2005 22:08, John (J5) Palmieri wrote:
> 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?
This issue has been discussed here:
http://lists.freedesktop.org/pipermail/dbus/2004-October/001662.html
In short:
* Deadlock detection can not be made 100% foolproof
* When detecting deadlock there are two options: The call can be handled
(causing reentrancy) or the call can fail.
* In KDE we have seen a need to be able to make calls to oneself.
Unfortunately all options sort of suck in their own way. Maks, do you have
ideas?
Cheers,
Waldo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050608/39d67be6/attachment.pgp
More information about the dbus
mailing list