Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions bin/varnishd/mgt/mgt_child.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ mgt_reap_child(void)
{
int i;
int status = 0xffff;
vtim_dur timeout;
const char *tip;
struct vsb *vsb;
pid_t r = 0;

Expand Down Expand Up @@ -547,9 +549,17 @@ mgt_reap_child(void)
vsb = VSB_new_auto();
XXXAN(vsb);

if (mgt_param.shutdown_timeout > mgt_param.cli_timeout) {
timeout = mgt_param.shutdown_timeout;
tip = "";
} else {
timeout = mgt_param.cli_timeout;
tip = " (tip: set shutdown_timeout)";
}

(void)VFIL_nonblocking(child_output);
/* Wait for child to die */
for (i = 0; i < mgt_param.cli_timeout * 10; i++) {
for (i = 0; i < timeout * 10; i++) {
(void)child_listener(NULL, VEV__RD);
r = waitpid(child_pid, &status, WNOHANG);
if (r == child_pid)
Expand All @@ -558,7 +568,7 @@ mgt_reap_child(void)
}
if (r == 0) {
VSB_printf(vsb, "Child (%jd) not dying (waitpid = %jd),"
" killing\n", (intmax_t)child_pid, (intmax_t)r);
" killing%s\n", (intmax_t)child_pid, (intmax_t)r, tip);

/* Kick it Jim... */
(void)kill_child();
Expand Down
13 changes: 13 additions & 0 deletions include/tbl/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,19 @@ PARAM_SIMPLE(
"If cli_timeout is longer than startup_timeout, it is used instead."
)

PARAM_SIMPLE(
/* name */ shutdown_timeout,
/* type */ timeout,
/* min */ "0.000",
/* max */ NULL,
/* def */ "0.000",
/* units */ "seconds",
/* descr */
"Alternative timeout for the worker process shutdown after a stop "
"cli command.\n"
"If cli_timeout is longer than shutdown_timeout, it is used instead."
)

PARAM_SIMPLE(
/* name */ clock_skew,
/* type */ uint,
Expand Down