[systemd-devel] systemd DBus services exit when they have clients

Stef Walter stefw at redhat.com
Fri Nov 14 08:06:47 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14.11.2014 14:41, Mantas Mikulėnas wrote:
> On Fri, Nov 14, 2014 at 3:43 PM, Stef Walter <stefw at redhat.com 
> <mailto:stefw at redhat.com>> wrote:
> 
> Is it intentional (or just laziness :D) that systemd DBus services 
> like hostnamed, timedated and friends all exit after a timeout
> even while callers that have invoked their methods are still on the
> bus?
> 
> Don't get me wrong, I like services that exit when not in use. But
> I sorta imagined 'not in use' as 'no more callers around'.
> 
> 
> I guess the idea is that many clients (e.g. gnome-settings-daemon)
> would make a few calls on startup and then continue running for
> days without ever touching the service again.
> 
> What are the actual problems caused by this? (I'm guessing
> something might rely on `hostnamed` watching
> /proc/sys/kernel/hostname, or things like that?)

In the case of Cockpit we have proxies that expose the properties of
DBus interfaces from the service. And you can watch that proxy to see
when stuff changes. When the service goes away the proxy becomes
invalid. Here's an example I just put together:

http://stef.thewalter.net/using-dbus-from-javascript-in-cockpit.html

But since Cockpit 0.31 we just ping the DBus service so it doesn't
feel lonely, and knows we're still interested ... for as long as we're
actually interested:

https://github.com/cockpit-project/cockpit/commit/aee825ef6d5ec4a6f8a4f25bc208b6f5ed4a9e96

> Maybe the services could have Subscribe() methods to cause them to
> stick around...

Yes also not a bad idea.

Stef

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlRmKJcACgkQe/sRCNknZa97ZgCfcW3XtPDHiN9kpfqukQp8Zncn
ioEAn3srFT3FMYFZsGkoVh1pUOERawuv
=Rn3k
-----END PGP SIGNATURE-----


More information about the systemd-devel mailing list