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.
This commit is contained in:
William Lallemand 2025-08-19 16:53:21 +02:00
parent ca5511f022
commit 67cb6aab90

View File

@ -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) {