From: William Lallemand Date: Tue, 19 Aug 2025 14:53:21 +0000 (+0200) Subject: BUG/MEDIUM: mworker: more verbose error upon loading failure X-Git-Tag: v3.3-dev7~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67cb6aab9006f19cd6478040fb8adc2f7c6153d6;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mworker: more verbose error upon loading failure When a worker crashes during its configuration parsing and without emitting any messages, the master will emit the message "Failed to load worker!". However that doesn't give us neither the PID of the worker, nor the status code. This patch fixes the problem by emitting a more verbose error. Must be backported as far as 3.1. --- diff --git a/src/mworker.c b/src/mworker.c index a2a4e7f07..fea592008 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -486,7 +486,7 @@ void mworker_catch_sigterm(struct sig_handler *sh) * Performs some routines for the worker process, which has failed the reload, * updates the global load_status. */ -static void mworker_on_new_child_failure() +static void mworker_on_new_child_failure(int exitpid, int status) { struct mworker_proc *child; @@ -500,7 +500,7 @@ static void mworker_on_new_child_failure() usermsgs_clr(NULL); load_status = 0; - ha_warning("Failed to load worker!\n"); + ha_warning("Failed to load worker (%d) exited with code %d (%s)\n", exitpid, status, (status >= 128) ? strsignal(status - 128): "Exit"); /* the sd_notify API is not able to send a reload failure signal. So * the READY=1 signal still need to be sent */ if (global.tune.options & GTUNE_USE_SYSTEMD) @@ -550,7 +550,7 @@ restart_wait: /* We didn't find the PID in the list, that shouldn't happen but we can emit a warning */ ha_warning("Process %d exited with code %d (%s)\n", exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit"); } else if (child->options & PROC_O_INIT) { - mworker_on_new_child_failure(); + mworker_on_new_child_failure(exitpid, status); /* Detach all listeners */ for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {