[master] 0f291ee Add error checking to confirm bug

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Wed Oct 12 10:37:04 CEST 2016


commit 0f291ee97dd6afe4e9c5500d4db15cc39c86c7c9
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date:   Wed Sep 28 14:54:29 2016 +0200

    Add error checking to confirm bug
    
    There seems to be an error in the varnish jail design, which makes the
    mgt process uable to kill the child process. To confirm this, add some
    error checking to the relevant code.
    
    Related to: #2010

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 58588db..e486d55 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -34,6 +34,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <errno.h>
 #include <fcntl.h>
 #include <poll.h>
 #include <signal.h>
@@ -583,17 +584,22 @@ mgt_reap_child(void)
 void
 MGT_Child_Cli_Fail(void)
 {
+	int i;
 
 	if (child_state != CH_RUNNING)
 		return;
 	if (child_pid < 0)
 		return;
-	MGT_complain(C_ERR, "Child (%jd) not responding to CLI, killing it.",
-	    (intmax_t)child_pid);
 	if (MGT_FEATURE(FEATURE_NO_COREDUMP))
-		(void)kill(child_pid, SIGKILL);
+		i = kill(child_pid, SIGKILL);
+	else
+		i = kill(child_pid, SIGQUIT);
+	if (i == 0)
+		MGT_complain(C_ERR, "Child (%jd) not responding to CLI,"
+		    " killing it.", (intmax_t)child_pid);
 	else
-		(void)kill(child_pid, SIGQUIT);
+		MGT_complain(C_ERR, "Failed to kill child with PID %jd: %s",
+		    (intmax_t)child_pid, strerror(errno));
 }
 
 /*=====================================================================



More information about the varnish-commit mailing list