From 67cb6aab9006f19cd6478040fb8adc2f7c6153d6 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Tue, 19 Aug 2025 16:53:21 +0200 Subject: [PATCH] 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. --- src/mworker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) { -- 2.47.3