[systemd-devel] Different behaviour when sending SIGTERM
Marcos Felipe Rasia de Mello
marcosfrm at gmail.com
Fri Apr 3 11:00:22 PDT 2015
2015-04-03 12:49 GMT-03:00 Lennart Poettering <lennart at poettering.net>:
> On Sun, 29.03.15 19:33, Marcos Mello (marcosfrm at gmail.com) wrote:
>
>> Mar 29 15:21:16 xxx.localdomain systemd[1]: squid.service: Supervising
>> process 1491 which is not our child. We'll most likely not notice when it exits.
>
> This is probably the source of your problems: squid's main process (or
> what is reported to be it) is not a child of PID 1. THis means PID 1
> will not get SIGCHLD for it, but its parent process, for whatever that
> is. This then means PID 1 will not notice that squid is gone and will
> eventuall SIGKILL all remaining processes in the cgroup...
>
Yes. It creates this:
PID1
\_ MASTER/PARENT
\_ WORKER <--- PID FILE
\_ KID 1
\_ KID 2
...
The process that needs to be signalled (for log rotation, config
reload, shutdown, etc) is the 'worker'. If I remove PIDFile (systemd
will guess 'master' as the main pid), put KillMode=none and
ExecStop=/usr/sbin/squid -k shutdown, it will work, but I consider a
very ugly setup. It can be even worse, because there is a
configuration (shutdown_lifetime) in squid.conf that makes the
'worker' wait n seconds before shutdown (and it does not block when
signalled!).
What a mess squid is doing...
Non-forking mode (squid -N) is the only sane solution, but
unfortunately one feature is missing when -N is used:
http://wiki.squid-cache.org/Features/SmpScale
More information about the systemd-devel
mailing list