Skip to content

Commit

Permalink
Add error checking to confirm bug
Browse files Browse the repository at this point in the history
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: varnishcache#2010
  • Loading branch information
hermunn committed Oct 10, 2016
1 parent dfcf44c commit 2c215ba
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bin/varnishd/mgt/mgt_child.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <sys/types.h>
#include <sys/wait.h>

#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <signal.h>
Expand Down Expand Up @@ -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));
}

/*=====================================================================
Expand Down

0 comments on commit 2c215ba

Please sign in to comment.