[systemd-devel] [PATCH] service: don't create extra cgroup for control process when reloading SysV service

Lukáš Nykrýn lnykryn at redhat.com
Thu Mar 13 01:40:45 PDT 2014


St 12. březen 2014, 18:34:11 CET, Uoti Urpala napsal:
> On Wed, 2014-03-12 at 16:51 +0100, Lennart Poettering wrote:
>> On Mon, 10.03.14 15:25, Lukas Nykryn (lnykryn at redhat.com) wrote:
>>
>>> Unfortunately common practice in initscripts is to have reload as an
>>> alias for restart (https://fedoraproject.org/wiki/Packaging:SysVInitScript).
>>> In that case the newly started process will be killed immediately after
>>> the reload process ends and its cgroup is destroyed.
>
>
>> I am not sure I grok why this all would be a problem at all, given that
>> on Fedora/RHEL we redirect those verbs to systemctl anyway, and
>> systemctl handles reload/restart on its own anyway... What am I missing?
>
> But systemctl supports using the reload functionality in init scripts,
> so that doesn't really make a difference. As I understood the problem
> description, this is what happens: someone runs "systemctl reload
> foo.service" for a broken sysv script, systemd sees that the script
> seems to support a "reload" argument and runs "/etc/init.d/foo reload"
> in a temporary cgroup, but the broken script stops the running service
> and starts a new one in the temporary cgroup.
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Exactly. Systemd exec /etc/init.d/foo reload in control "subgroup". 
Than the initscript kills the original deamon, starts a new one and 
quits. Systemd sees that the reload process finished and kills 
remaining processes in the control group, thus kills the daemon.

This patch works quite fine when the initscripts is using pid files, 
systemd correctly updates the information about main pid.




More information about the systemd-devel mailing list