[systemd-devel] [PATCH] man: document kill behavior after the main process exits
Lennart Poettering
lennart at poettering.net
Thu Apr 23 08:32:30 PDT 2015
On Thu, 23.04.15 09:20, Daniel Drake (drake at endlessm.com) wrote:
> - timeout, if the normal shutdown procedure left processes of
> - the service around. Takes a boolean value. Defaults to "yes".
> + timeout, if the normal shutdown procedure didn't succeed in
> + shutting down the main process. Takes a boolean value.
> + Defaults to "yes".
I think this really should clarify that this is about leaving
processes around.
> </para></listitem>
> </varlistentry>
>
> @@ -163,6 +164,31 @@
> </refsect1>
>
> <refsect1>
> + <title>Beyond the main process</title>
> +
> + <para>The <varname>KillMode=</varname> option primarily defines
> + behavior up until the point where the main process has gone away.
> + systemd expects that when killed with the signal specified by
> + <varname>KillSignal=</varname>, the main process will kill and
> + reap all the other processes in the control group before
> + exiting itself.
Well, I don't think this is right. I mean, systemd doesn't really
"expect" this. It's completely OK if daemons leave children around in
this case.
KillMode= is actually very much about the time after the main process
died. If KillMode=process is specified systemd should not send any
signal to anything but the main process, and that applies to both
SIGTERm and the following SIGKILL:
> If that doesn't happen, and the main process
> + exits with other processes still running in the control group,
> + systemd gets a bit more heavy-handed:</para>
I'd prefer not using words like "heavy-handed" here.
> +
> + <para>If <option>KillMode=control-group</option>, systemd will
> + then send a second <varname>KillSignal=</varname> signal to the
> + remaining processes, which will then be followed by a
> + <constant>SIGKILL</constant> if processes are still around, even
> + if <option>SendSIGKILL=no</option>.</para>
Hmm, no? SendSIGKILL=no should have the effect of not sending any
SIGKILL at all. Anything else would be a bug.
> +
> + <para>Or, if <option>KillMode=mixed</option>, systemd will
> + directly send <constant>SIGKILL</constant> to all remaining members
> + of the control group, regardless of the
> + <varname>SendSIGKILL=</varname> preference.</para>
Hmm? No, not at all. If you use "mixed", then SIGTERM is is sent to
the main process of the daemon, and SIGKILL to *al* processes of the
daemon if there are any left after the main process exited.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list