[4.1] c6efe04 Add error checking to confirm bug
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Wed Oct 12 16:12:05 CEST 2016
commit c6efe045ff12c1f192d15caf5683f65b0aca34e2
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 2fa0795..f89f6d4 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>
@@ -587,17 +588,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