Activation of multiple services provided by the same executable

Thiago Macieira thiago at kde.org
Wed Mar 27 15:01:33 PDT 2013


On quarta-feira, 27 de março de 2013 19.46.19, Darren Garvey wrote:
> We have a situation where some of our processes expose themselves over dbus
> with more than one well-known name. There are a few reasons this may be
> done:
> 
> * For optimisation - moving two or more increasingly tightly coupled
> components into one process; * Legacy - providing legacy adaptor interfaces
> from a newer daemon. * Prototyping - starting with a single-process
> implementation, knowing that we want to provide separate interfaces over
> different bus-names.
> 
> In these situations, we still provide service files for each bus-name and
> they all point to the same executable. My expectation was that dbus-daemon
> would take care of process spawning and avoid any race conditions during
> activation. IIUC dbus-daemon provides this guarantee for concurrent
> requests to activate a service, but doesn't appear to support concurrent
> requests to activate different services that are provided by the same
> executable. We're seeing multiple instances of an executable started
> occasionally which we believe is caused by this.

Why is this a problem for you? Shouldn't your executable exit if it could not 
acquire the names? If you always acquire them in the same order, the first 
acquisition will fail if another instance is already running. You simply have 
to exit.

The daemon should route the message to the other instance once that has a 
name.

Be careful, though: if you don't know which name the daemon was expecting your 
process to register, you should wait until all three names are present before 
exiting. If you always register A, B, C in that order, the daemon launched you 
for C and you exit when only A is registered, the daemon will send a failed 
activation reply to the sender that was calling C.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130327/09ddb177/attachment.pgp>


More information about the dbus mailing list