]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: debug: fix incorrect profiling status reporting in show threads
authorWilly Tarreau <w@1wt.eu>
Thu, 4 May 2023 09:30:55 +0000 (11:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 4 May 2023 09:41:33 +0000 (11:41 +0200)
Thread dumps include a field "prof" for each thread that reports whether
task profiling is currently active or not. It turns out that in 2.7-dev1,
commit 680ed5f28 ("MINOR: task: move profiling bit to per-thread")
mistakenly replaced it with a check for the current thread's bit in the
thread dumps, which basically is the only place where another thread is
being watched. The same mistake was done a few lines later by confusing
threads_want_rdv_mask with the profiling mask. This mask disappeared
in 2.7-dev2 with commit 598cf3f22 ("MAJOR: threads: change thread_isolate
to support inter-group synchronization"), though instead we know the ID
of the isolated thread. This commit fixes this and now reports "isolated"
instead of "wantrdv".

This can be backported to 2.7.

src/debug.c

index a68c45df75595a7ee8dbedd0f20d62a14c97a3a4..a53d3491d52d69a85f369f75287195342be10755 100644 (file)
@@ -198,12 +198,12 @@ void ha_thread_dump(struct buffer *buf, int thr, int calling_tid)
                      ha_thread_ctx[thr].rq_total,
                      ha_thread_info[thr].tgid, ha_thread_info[thr].ltid + 1,
                      stuck,
-                     !!(th_ctx->flags & TH_FL_TASK_PROFILING));
+                     !!(ha_thread_ctx[thr].flags & TH_FL_TASK_PROFILING));
 
        chunk_appendf(buf,
-                     " harmless=%d wantrdv=%d",
+                     " harmless=%d isolated=%d",
                      !!(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit),
-                     !!(th_ctx->flags & TH_FL_TASK_PROFILING));
+                     isolated_thread == thr);
 
        chunk_appendf(buf, "\n");
        chunk_appendf(buf, "             cpu_ns: poll=%llu now=%llu diff=%llu\n", p, n, n-p);