Re: How best to ensure s6-managed services are shut down cleanly?

From: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups_at_NTLWorld.COM>
Date: Sat, 2 Feb 2019 02:19:42 +0000

Laurent Bercot:

> The question is, how does systemd decide to proceed with the rest of
> the shutdown?
>
It waits for |s6-svscan| for up to 90s, putting the infamous cylon
warrior and "A stop job is running for s6" message on the console.
After 90s, it starts forcibly killing stuff, not necessarily in the
right order because it does not know that PostgreSQL should be killed
before |s6-svscan| and that main services are best taken down before log
services.

No, it will not wait forever for |s6-svscan| to exit. That is not a way
to block it.

I arrange things differently for running |service-manager| under systemd
<http://jdebp.eu./Softwares/nosh/guide/svscan-startup.html#systemd>:

    % grep ExecStop /usr/local/lib/systemd/system/system-control-normal.service
    ExecStop=/bin/system-control start --verbose shutdown
    %

|system-control|
<http://jdebp.eu./Softwares/nosh/guide/commands/system-control.xml> has
all of the logic that knows to try harder if a |TERM| signal does not
stop a service within 60s, and the |start| of |shutdown| stops running
normal services because the |shutdown| service has |conflicts/|
relationships with them. None of this logic is in the service manager
itself, which does not need to know about timeouts and alternative
signals, it comprising mechanism not policy.

systemd will still try sending |TERM| signals to the service manager and
force-killing stuff out of order, but because of an |After=| ordering
only /after/ the |ExecStop| of |system-control-normal.service| has had
its chance to shut things down in an orderly fashion. systemd does not
even begin taking down the service manager until after |system-control|
has attempted to shut down all managed services.
Received on Sat Feb 02 2019 - 02:19:42 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC