supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
To: Supervision <supervision@list.skarnet.org>
Subject: Re: How best to ensure s6-managed services are shut down cleanly?
Date: Sat, 2 Feb 2019 02:19:42 +0000	[thread overview]
Message-ID: <25b14650-8e6b-c113-f924-130c88778f35@NTLWorld.COM> (raw)
In-Reply-To: <em5557b522-9ea3-4170-b228-1988636ba1f5@elzian>

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

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.


  reply	other threads:[~2019-02-02  2:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 18:25 Brett Neumeier
2019-02-01 19:46 ` Laurent Bercot
2019-02-02  2:19   ` Jonathan de Boyne Pollard [this message]
2019-02-02 14:26   ` Brett Neumeier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25b14650-8e6b-c113-f924-130c88778f35@NTLWorld.COM \
    --to=j.deboynepollard-newsgroups@ntlworld.com \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).