From 45a64123d60e3ad4b59ba1664b260f8a7f3eea7a Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 8 Jun 2026 02:07:03 +0200 Subject: [PATCH] BUG/MEDIUM: threads: Fiw build when using no thread In thread_detect_count(), avoid any usage of thread_cpu_enable_at_boot if we're building without thread support. That variable is only defined when building with threads, and those tests make little sense when building with no thread, anyway. This was submitted by: ririnto This should fix github issue #3408. This should be backported to 3.4. --- src/thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/thread.c b/src/thread.c index 57f4b5aec..6c636d75d 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1667,7 +1667,9 @@ void thread_detect_count(void) char *err __maybe_unused; int thr_forced = 0; int tgrp_forced = 0; +#ifdef USE_THREAD int cpus_detected = 0; +#endif thr_min = 1; thr_max = MAX_THREADS; grp_min = 1; grp_max = MAX_TGROUPS; @@ -1810,6 +1812,7 @@ void thread_detect_count(void) if (!global.nbtgroups) global.nbtgroups = grp_min; +#ifdef USE_THREAD if (tgrp_forced && !thr_forced && !cpu_map_in_conf && (!global.thread_limit || (global.nbthread < global.thread_limit)) && global.nbthread < MIN(cpus_detected, thread_cpus_enabled_at_boot) && @@ -1828,6 +1831,7 @@ void thread_detect_count(void) ha_notice("%d usable CPUs detected but 'nbthread' forced to %d (%d%%). Remove 'nbthread' for optimal tuning.\n", nbcpus, global.nbthread, global.nbthread * 100 / nbcpus); } +#endif if (global.nbthread > global.maxthrpertgroup * global.nbtgroups) { ha_diag_warning("nbthread too large or not set, found %d CPUs, limiting to %d threads (maximum is %d per thread group and %d groups). Please set nbthreads and/or increase thread-groups in the global section to silence this warning.\n",