Thread (10 messages) 10 messages, 5 authors, 2021-12-08

Re: [PATCH] mdadm/systemd: change KillMode from none to mixed in service files

flat view

From: NeilBrown <hidden>
Date: 2021-12-08 21:27:56

On Thu, 09 Dec 2021, Franck Bui wrote:
Hi,

On 12/7/21 1:34 PM, Benjamin Brunner wrote:
quoted
quoted
quoted
quoted
Please correct me if I am wrong, I see the difference of the KillMode is,
-- KillMode=mixed stops the processes more gentally, it kill the main
process with SIGTERM and the remaining processes with SIGKILL.
-- KillMode=control-group kills all in-cgroup processes with SIGKILL,
which I feel a bit cruel for the main process.
I think there's a miss-understanding here.

Regardless of whether "mixed" or "control-group" mode (or any other mode
actually) is used, the process used to kill processes part of a service is
always the same, only the list of the killed processes differs.

The process is as follow:

 1. send the signal specified by KillSignal= to the list of processes (if
    any), TERM is the default
 2. wait until either the target of process(es) exit or a timeout expires
 3. if the timeout expires send the signal specified by FinalKillSignal=,
    KILL is the default

For "control-group", all remaining processes will receive the SIGTERM signal (by
default) and if there are still processes after a period f time, they will get
the SIGKILL signal.

For "mixed", only the main process will receive the SIGTERM signal, and if there
are still processes after a period of time, all remaining processes (including
the main one) will receive the SIGKILL signal.
quoted
quoted
quoted
There is no point sending SIGTERM to a process which doesn't respond to
it.  mdmon is the only mdadm service which handles SIGTERM.  So it might
make sense to uise KillMode=mixed for that.
For anything else, SIGKILL via KillMode=control-group is perfectly
acceptable.
I don't know enough mdadm to suggest a mode but maybe the clarification above
will help you figuring this out.

That said it sounds a bit strange that some processes don't respond to SIGTERM.
Is that done because some services need to run lately during the shutdown process ?
When I wrote that they don't respond to SIGTERM, I meant that they don't
take any special action.  They don't ignore SIGTERM, so they will exit
when they are sent it.  i.e.  it doesn't matter whether they get SIGTERM
or SIGKILL - either way they will exit.

NeilBrown
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help