[systemd-devel] Scope units get SIGKILL when stopped, not SIGTERM

Michael Chapman mike at very.puzzling.org
Sun Nov 30 16:14:42 PST 2014


On Sun, 30 Nov 2014, Lennart Poettering wrote:
> The only solution that will really fix this for good is probably to
> move things to the new unified cgroup controller logic that finally
> gives us useful ways to get notifications for cgroups running empty.
>
> Also see what I just replied here:
>
> http://lists.freedesktop.org/archives/systemd-devel/2014-November/025734.html

Maybe I'm misunderstanding the problem. I don't see how unreliable cgroup 
empty notifications is a problem.

scope_stop starts watching all PIDs in the cgroup. After all processes in 
the scope are SIGTERMed, you may or may not get SIGCHLD for them, 
depending on whether they actually exit on TERM and whether they had been 
reparented to PID 1 first. Each time you receive a SIGCHLD, you can check 
to see whether the cgroup is empty. This logic appears to be already in 
place.

Only if TimeoutStopSec is hit should there be a need to re-iterate 
remaining PIDs in the cgroup (or discover that it has actually emptied 
without you receiving the final SIGCHLD) and SIGKILL them.

As Ross Lagerwall pointed out in 
http://lists.freedesktop.org/archives/systemd-devel/2014-November/025700.html, 
this problem isn't actually specific to scope units.

- Michael


More information about the systemd-devel mailing list