]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mworker: display a more accessible message when a worker crash
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 5 Sep 2023 13:25:38 +0000 (15:25 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 5 Sep 2023 13:31:04 +0000 (15:31 +0200)
Should fix issue #1034.

Display a more accessible message when a worker crash about what to do.

Example:

$ ./haproxy -W -f haproxy.cfg
[NOTICE]   (308877) : New worker (308884) forked
[NOTICE]   (308877) : Loading success.
[NOTICE]   (308877) : haproxy version is 2.9-dev4-d90d3b-58
[NOTICE]   (308877) : path to executable is ./haproxy
[ALERT]    (308877) : Current worker (308884) exited with code 139 (Segmentation fault)
[WARNING]  (308877) : A worker process unexpectedly died and this can only be explained by a bug in haproxy or its dependencies.
Please check that you are running an up to date and maintained version of haproxy and open a bug report.
HAProxy version 2.9-dev4-d90d3b-58 2023/09/05 - https://haproxy.org/
Status: development branch - not safe for use in production.
Known bugs: https://github.com/haproxy/haproxy/issues?q=is:issue+is:open
Running on: Linux 6.2.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 14 13:42:26 UTC 2023 x86_64
[ALERT]    (308877) : exit-on-failure: killing every processes with SIGTERM
[WARNING]  (308877) : All workers exited. Exiting... (139)

src/mworker.c

index 6bace6b4684c480ae3b163e31efa513d0ce18584..b773bfe726631f9ed0dfa7514fbb75134b4f40c1 100644 (file)
@@ -385,10 +385,15 @@ restart_wait:
                                else if (child->options & PROC_O_TYPE_PROG)
                                        ha_alert("Current program '%s' (%d) exited with code %d (%s)\n", child->id, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
 
-                               if (status != 0 && status != 130 && status != 143
-                                   && !(global.tune.options & GTUNE_NOEXIT_ONFAILURE)) {
-                                       ha_alert("exit-on-failure: killing every processes with SIGTERM\n");
-                                       mworker_kill(SIGTERM);
+                               if (status != 0 && status != 130 && status != 143) {
+                                       if (child->options & PROC_O_TYPE_WORKER) {
+                                               ha_warning("A worker process unexpectedly died and this can only be explained by a bug in haproxy or its dependencies.\nPlease check that you are running an up to date and maintained version of haproxy and open a bug report.\n");
+                                               display_version();
+                                       }
+                                       if (!(global.tune.options & GTUNE_NOEXIT_ONFAILURE)) {
+                                               ha_alert("exit-on-failure: killing every processes with SIGTERM\n");
+                                               mworker_kill(SIGTERM);
+                                       }
                                }
                                /* 0 & SIGTERM (143) are normal, but we should report SIGINT (130) and other signals */
                                if (exitcode < 0 && status != 0 && status != 143)