]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: debug: make the debug_handler check for the thread in threads_to_dump
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 07:31:34 +0000 (08:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 07:31:34 +0000 (08:31 +0100)
It happens that just sending the debug signal to the process makes on
thread wait for its turn while nobody wants to dump. We need to at
least verify that a dump was really requested for this thread.

This can be backported to 2.1 and 2.0.

src/debug.c

index 3c18ff0801c7e1b90116061f784b32cb98c100f9..0cd6ef1a825b66c4af553b78789894a7769ae5b4 100644 (file)
@@ -645,6 +645,12 @@ void ha_thread_dump_all_to_trash()
 /* handles DEBUGSIG to dump the state of the thread it's working on */
 void debug_handler(int sig, siginfo_t *si, void *arg)
 {
+       /* first, let's check it's really for us and that we didn't just get
+        * a spurious DEBUGSIG.
+        */
+       if (!(threads_to_dump & tid_bit))
+               return;
+
        /* There are 4 phases in the dump process:
         *   1- wait for our turn, i.e. when all lower bits are gone.
         *   2- perform the action if our bit is set