From 4f0c6a2e6e75e3eaec45c91792a46e3a02405a45 Mon Sep 17 00:00:00 2001 From: Quentin Armitage Date: Sun, 29 Nov 2015 09:41:39 +0000 Subject: Don't wait on script process being killed after timeout The child_timout_thread functions send a SIGKILL to a child process that has timed out and didn't die quickly enough after sending a SIGTERM. They then wait on the process dying. The main problem is that if the waitpid is successful here, then waitpid in thread_child_handler will never be successful for the same pid, and so the entry on the child list will never be removed and the parent thread will not be marked as ready. There is also a theoretical possibility that the child process is unkillable, and so the waitpid would hang forever. Signed-off-by: Quentin Armitage (cherry picked from commit ea16907499ffe8f5fc05987bb2b2a1d46dd776be) --- keepalived/check/check_misc.c | 1 - keepalived/vrrp/vrrp_scheduler.c | 1 - 2 files changed, 2 deletions(-) diff --git a/keepalived/check/check_misc.c b/keepalived/check/check_misc.c index 79e08b5..4e59b27 100644 --- a/keepalived/check/check_misc.c +++ b/keepalived/check/check_misc.c @@ -270,7 +270,6 @@ misc_check_child_timeout_thread(thread_t * thread) } log_message(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid); - waitpid(pid, NULL, 0); return 0; } diff --git a/keepalived/vrrp/vrrp_scheduler.c b/keepalived/vrrp/vrrp_scheduler.c index e887130..73c5dfe 100644 --- a/keepalived/vrrp/vrrp_scheduler.c +++ b/keepalived/vrrp/vrrp_scheduler.c @@ -1099,7 +1099,6 @@ vrrp_script_child_timeout_thread(thread_t * thread) } log_message(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid); - waitpid(pid, NULL, 0); return 0; } -- 1.7.12.1