]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: consider non-SERVICE_EXEC_START commands for EXIT_CLEAN_COMMAND
authorAnita Zhang <the.anitazha@gmail.com>
Thu, 21 Feb 2019 18:37:40 +0000 (10:37 -0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Feb 2019 09:18:39 +0000 (10:18 +0100)
commite51237253ecd343caac88f642049765b33c946ec
treeb3ef41df8904117ea4092d3fa9e7496422b83b2c
parent453823a290cd08e4a00d89fbc4df996e31d32740
core: consider non-SERVICE_EXEC_START commands for EXIT_CLEAN_COMMAND

When there are multiple ExecStop= statements, the next command would continue
to run even after TimeoutStopSec= is up and sends SIGTERM. This is because,
unless Type= is oneshot, the exit code/status would evaluate to SERVICE_SUCCESS
in service_sigchld_event()'s call to is_clean_exit(). This success indicates
following commands would continue running until the end of the list
is reached, or another timeout is hit and SIGKILL is sent.

Since long running processes should not be invoked in non-SERVICE_EXEC_START
commands, consider them for EXIT_CLEAN_COMMAND instead of EXIT_CLEAN_DAEMON.
Passing EXIT_CLEAN_COMMAND to is_clean_exit() evaluates the SIGTERM exit
code/status to failure and will stop execution after the first timeout is hit.

Fixes #11431
src/core/service.c