BUG/MINOR: mworker: ensure that we still quits with SIGINT

Since the fix "BUG/MINOR: mworker: don't exit with an ambiguous value"
we are leaving with a EXIT_SUCCESS upon a SIGINT.

We still need to quit with a SIGINT when a worker leaves with a SIGINT.

This is done this way because vtest expect a 130 during the process
stop, haproxy without mworker returns a 130, so it should be the same in
mworker mode.

This should be backported in 1.9, with the previous patch ("BUG/MINOR:
mworker: don't exit with an ambiguous value").

Code has moved, mworker_catch_sigchld() is in haproxy.c.
This commit is contained in:
William Lallemand 2019-04-16 17:42:44 +02:00 committed by Willy Tarreau
parent 4cf4b33744
commit 74f0ec3894
1 changed files with 3 additions and 2 deletions

View File

@ -275,10 +275,11 @@ void mworker_catch_sigchld(struct sig_handler *sh)
if (status != 0 && status != 130 && status != 143 if (status != 0 && status != 130 && status != 143
&& !(global.tune.options & GTUNE_NOEXIT_ONFAILURE)) { && !(global.tune.options & GTUNE_NOEXIT_ONFAILURE)) {
ha_alert("exit-on-failure: killing every processes with SIGTERM\n"); ha_alert("exit-on-failure: killing every processes with SIGTERM\n");
if (exitcode < 0)
exitcode = status;
mworker_kill(SIGTERM); mworker_kill(SIGTERM);
} }
/* 0 & SIGTERM (143) are normal, but we should report SIGINT (130) and other signals */
if (exitcode < 0 && status != 0 && status != 143)
exitcode = status;
} else { } else {
if (child->options & PROC_O_TYPE_WORKER) { if (child->options & PROC_O_TYPE_WORKER) {
ha_warning("Former worker #%d (%d) exited with code %d (%s)\n", child->relative_pid, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit"); ha_warning("Former worker #%d (%d) exited with code %d (%s)\n", child->relative_pid, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");