[systemd-devel] Dependencies on DBus activated services during shutdown

Lennart Poettering lennart at poettering.net
Wed Jan 24 11:48:09 UTC 2018


On Mo, 08.01.18 16:07, Michal Koutný (mkoutny at suse.com) wrote:

> Hello,
> I'd like to ask your opinion on the following situation.
> 
> B.service exposes its API through D-Bus. A.service uses this API and
> thus it has a dependency on B.service. This is implicit though -- and
> we're happy we can rely on D-Bus activation and needn't to list all
> dependencies explicitly.
> 
> As it comes, A.service needs B.service for proper termination. During
> the shutdown transaction there is unspecified ordering of the two (since
> the dependency is implicit only) and B.service is stopped before
> A.service.

If you need it for proper termination you should declare the dep
really.

My general recommendation would be though to write daemons in a
fashion that they do not require any other daemons to shut down in an
orderly fashion. It's a matter of general robustness I guess: if your
daemon is written in a way that it basically can die abruptly any time
without leaving unclean state around then this also means that
shutting it down always works and has no dependencies. That said, I am
full aware that it might not be possible to write all daemons in this
fashion...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list