[systemd-devel] extra SIGTERM

Jan Engelhardt jengelh at medozas.de
Thu Dec 29 17:25:02 PST 2011


On Friday 2011-12-30 01:14, Michael D. Berger wrote:
>   [Service]
>   PIDFile=/var/lock/subsys/myDaemon
>   Type=simple
>   ControlGroup=cpu:/
>   ExecStart=/usr/sbin/myDaemon --daemon
>   #ExecStop=/bin/kill -s SIGTERM $MAINPID
>
>Using the service as shown, when I stop myDaemon, it gets one SIGTERM .
>However, if I uncomment the ExecStop line, it gets two SIGTERMs
>in rapid succession. Looks like a bug to me. What do you think?

Could be a SneakyFeature™. I can imagine that the current
avoid-fork hype has gone as far as to engulf sending the
termination signals.

On a more serious note, it seems documented:

       ExecStop=
           [...] All processes remaining for a service after the
           commands configured in this option are run are terminated according
           to the KillMode= setting.[...]

Sounds like your standard race condition: your process just did not
seem to have cleaned itself up and terminated fast enough before
the remaining-process-check ran.

In that regard, systemd seems right in what it does. Specifying
ExecStop=kill is sooo reminiscient of code duplication from
olde sysv init scripts.


More information about the systemd-devel mailing list