summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-27 19:56:57 +0200
committerLennart Poettering <lennart@poettering.net>2017-10-02 12:58:42 +0200
commit3c751b1bfaf734db09256a5631f1f9ce75cf0d35 (patch)
treee7da759e69a0869cc97350a83172545723b06a38 /src
parent07697d7ec501ccca25281b30c26b4b2dcbc357e7 (diff)
downloadsystemd-3c751b1bfaf734db09256a5631f1f9ce75cf0d35.tar.gz
service: a cgroup empty notification isn't reason enough to go down
The processes associated with a service are not just the ones in its cgroup, but also the control and main processes, which might possibly live outside of it, for example if they transitioned into their own cgroups because they registered a PAM session of their own. Hence, if we get a cgroup empty notification always check if the main PID is still around before taking action too eagerly. Fixes: #6045
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 56e07de69e..82d9bb585b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2871,7 +2871,9 @@ static void service_notify_cgroup_empty_event(Unit *u) {
* SIGCHLD for. */
case SERVICE_START:
- if (s->type == SERVICE_NOTIFY) {
+ if (s->type == SERVICE_NOTIFY &&
+ main_pid_good(s) == 0 &&
+ control_pid_good(s) == 0) {
/* No chance of getting a ready notification anymore */
service_enter_stop_post(s, SERVICE_FAILURE_PROTOCOL);
break;
@@ -2880,7 +2882,10 @@ static void service_notify_cgroup_empty_event(Unit *u) {
/* Fall through */
case SERVICE_START_POST:
- if (s->pid_file_pathspec) {
+ if (s->pid_file_pathspec &&
+ main_pid_good(s) == 0 &&
+ control_pid_good(s) == 0) {
+
/* Give up hoping for the daemon to write its PID file */
log_unit_warning(u, "Daemon never wrote its PID file. Failing.");