]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: more verbose error upon loading failure
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 19 Aug 2025 14:53:21 +0000 (16:53 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 20 Aug 2025 15:15:52 +0000 (17:15 +0200)
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

index a2a4e7f07b72f278f18a69b432292d2015ed84ed..fea5920082f1ff8d482bf69935dd6f45a17e1326 100644 (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) {