From 95e6c9999add657f3359ad82c1814d10e322cb4d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 7 May 2023 15:02:30 +0200 Subject: [PATCH] BUILD: debug: do not check the isolated_thread variable in non-threaded builds The build without thread support was broken by commit b30ced3d8 ("BUG/MINOR: debug: fix incorrect profiling status reporting in show threads") because it accesses the isolated_thread variable that is not defined when threads are disabled. In fact both the test on harmless and this one make no sense without threads, so let's comment out the block and mark the related variables as unused. This may have to be backported to 2.7 if the commit above is. --- src/debug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index ce9d44cd6b..8d87530cc6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -183,11 +183,11 @@ void ha_backtrace_to_stderr(void) void ha_thread_dump_one(int thr, int from_signal) { struct buffer *buf = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].thread_dump_buffer); - unsigned long thr_bit = ha_thread_info[thr].ltid_bit; + unsigned long __maybe_unused thr_bit = ha_thread_info[thr].ltid_bit; + int __maybe_unused tgrp = ha_thread_info[thr].tgid; unsigned long long p = ha_thread_ctx[thr].prev_cpu_time; unsigned long long n = now_cpu_time_thread(thr); int stuck = !!(ha_thread_ctx[thr].flags & TH_FL_STUCK); - int tgrp = ha_thread_info[thr].tgid; chunk_appendf(buf, "%c%cThread %-2u: id=0x%llx act=%d glob=%d wq=%d rq=%d tl=%d tlsz=%d rqsz=%d\n" @@ -208,10 +208,12 @@ void ha_thread_dump_one(int thr, int from_signal) stuck, !!(ha_thread_ctx[thr].flags & TH_FL_TASK_PROFILING)); +#if defined(USE_THREAD) chunk_appendf(buf, " harmless=%d isolated=%d", !!(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit), isolated_thread == thr); +#endif chunk_appendf(buf, "\n"); chunk_appendf(buf, " cpu_ns: poll=%llu now=%llu diff=%llu\n", p, n, n-p); -- 2.47.3