summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorYuxuan Shui <yshuiv7@gmail.com>2014-02-15 02:38:50 +0800
committerLukas Nykryn <lnykryn@redhat.com>2014-03-14 17:56:08 +0100
commit0ab7a0e4655fd1108fa3abc994f816a22073abc6 (patch)
tree1c436edcf2dbc4489e6b422134d4e7b343b78605 /src/core
parent495d57fb7487f29965a712acdc21f96273aa5c1d (diff)
core: fix detection of dead processes
Commit 5ba6985b moves the UNIT_VTABLE(u)->sigchld_event before systemd actually reaps the zombie. Which leads to service_load_pid_file accepting zombie as a valid pid. This fixes timeouts like: [ 2746.602243] systemd[1]: chronyd.service stop-sigterm timed out. Killing. [ 2836.852545] systemd[1]: chronyd.service still around after SIGKILL. Ignoring. [ 2927.102187] systemd[1]: chronyd.service stop-final-sigterm timed out. Killing. [ 3017.352560] systemd[1]: chronyd.service still around after final SIGKILL. Entering failed mode.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/service.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 41e5cb55f..d9bc02181 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1429,6 +1429,14 @@ static int service_load_pid_file(Service *s, bool may_warn) {
return -ESRCH;
}
+ if (get_process_state(pid) == 'Z') {
+ if (may_warn)
+ log_info_unit(UNIT(s)->id,
+ "PID "PID_FMT" read from file %s is a zombie.",
+ pid, s->pid_file);
+ return -ESRCH;
+ }
+
if (s->main_pid_known) {
if (pid == s->main_pid)
return 0;