race-free exit-on-idle (redux)

Lennart Poettering mzqohf at 0pointer.de
Thu May 14 02:06:46 PDT 2015


On Wed, 13.05.15 16:03, Colin Walters (walters at verbum.org) wrote:

> Hi,
> 
> On Wed, May 13, 2015, at 02:27 PM, Lennart Poettering wrote:
> 
> > But it only works for services which do not create
> > context objects based on method calls. 
> 
> Hmm, that is indeed an important restriction, one not tested by
> the current code.
> 
> It looks like of the systemd tools that exit-on-idle, networkd is a notable one
> that creates object paths.  (That's what you mean by "context objects" right?)
> 
> Ah, except `networkctl` doesn't talk DBus at all it looks like (correct?).  So
> that's moot until it does.
> 
> But obviously a lot of the nontrivial DBus services do create object paths.
> 
> It seems[1] that we could close this race by having
> sd_notify(false, "STOPPING=0"), and re-claim the bus name?
> 
> [1] Handwaving, I admit

Well, you can play such games, but this is not transparent to
clients. In GDBus it is common to invalidate client side proxy objects
when the bus services they wrap goes away. This logic will be very
confused if the bus name leaves the bus and then comes back as a
response to a bus call it made.

Most of systemd's services actually provide persistent objects, that
survive daemons departing from the bus. But most services are probably
not like that, and GDBus is right in assuming that objects are
invalidated then...

BTW, kdbus solves this all properly, because it knows
sd_bus_try_close() which will close the bus only if nothing is
queued. 

Lennart

-- 
Lennart Poettering, Red Hat


More information about the dbus mailing list