]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: report the process id in warnings and panics
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Sep 2025 04:55:25 +0000 (06:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Sep 2025 15:56:14 +0000 (17:56 +0200)
Warning and panic messages currently do not report the PID. This is
annoying when trying to reproduce problems because warnings do not
allow know which process to attach to in order to debug, and panics
do not permit to know which core dump corresponds to which dump.
Let's add them in both messages. This should probably be backported
at least to 3.2.

src/debug.c

index 600adb7beea847f6ca4c3b84721d50aa9126b116..0c3ecb1dc207d93d71d88b0b4f1a67982fca78dd 100644 (file)
@@ -777,7 +777,7 @@ void ha_panic()
                return;
        }
 
-       chunk_printf(&trash, "\nPANIC! Thread %u is about to kill the process.\n", tid + 1);
+       chunk_printf(&trash, "\nPANIC! Thread %u is about to kill the process (pid %d).\n", tid + 1, pid);
 
        /* dump a few of the post-mortem info */
        chunk_appendf(&trash, "\nHAProxy info:\n  version: %s\n  features: %s\n",
@@ -923,7 +923,7 @@ void ha_stuck_warning(void)
                             "          'global' section of your configuration to avoid this in the future.\n");
        }
 
-       chunk_appendf(&buf, " => Trying to gracefully recover now.\n");
+       chunk_appendf(&buf, " => Trying to gracefully recover now (pid %d).\n", pid);
 
        /* Note: it's important to dump the whole buffer at once to avoid
         * interleaved outputs from multiple threads dumping in parallel.