exit after auto-start

Havoc Pennington hp at redhat.com
Tue Oct 11 01:02:53 PDT 2005


On Sun, 2005-10-09 at 11:43 -0400, Dave Plauger wrote:
> Is there a reliable way for a service to exit?
> 
> I like using autostart. However, if several clients access the same service, it's not clear to me 
> how to code the service so that in can exit without losing a client. That is, client 1 can start the 
> service, client 2 right behind it can queue a message. If the service exits after handling client 1, 
> client 2 fails. I have seen this happen.
> 

I would guess the failure is because the message from client 2 has
already been queued for your service process when your service process
exits?

In that case the solution I can think of is to first drop ownership of
the bus name, then process your incoming queue, _then_ exit.

You might need the bus to support some kind of "deliver all my queued
messages, then disconnect me" feature.

Also I don't remember if the "disown bus name" patch went in yet.

Anyway, just write down exactly what race condition happens and the
solution is probably pretty clear, though it may involve changing dbus.

Havoc




More information about the dbus mailing list