From 960fa1c92146a9acb0899fff89397413890b5e57 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 11 Jun 2026 18:40:08 +0200 Subject: [PATCH] BUG/MINOR: cpu-topo: use ha_diag_notice() to report thread creations Using ha_diag_warning() to report the number of threads created resulted in warnings being counted and possibly an error being fired when combined with -dW: $ printf "global\nstats socket /tmp/sock1\n" | ./haproxy -dD -dW -c -f /dev/stdin; echo $? [NOTICE] (10406) : haproxy version is 3.5-dev0-5091ac-35 [NOTICE] (10406) : path to executable is ./haproxy [DIAG] (10406) : Created 20 threads split into 2 groups [ALERT] (10406) : Some warnings were found and 'zero-warning' is set. Aborting. 1 Now that we have ha_diag_notice(), let's use it: $ printf "global\nstats socket /tmp/sock1\n" | ./haproxy -dD -dW -c -f /dev/stdin; echo $? [DIAG] (10513) : Created 20 threads split into 2 groups 0 It would make sense to backport this to 3.2 because it helps validate configs against diag warnings without triggering a false positive. It depends on this previous patch: MINOR: errors: add ha_diag_notice() to report diag-level notifications --- src/cpu_topo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpu_topo.c b/src/cpu_topo.c index b14e69fae..fefefc9f0 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -1279,7 +1279,7 @@ static int cpu_policy_first_usable_node(int policy, int tmin, int tmax, int gmin if (tmin <= thr_count && thr_count < tmax) tmax = thr_count; - ha_diag_warning("Multi-socket cpu detected, automatically binding on active CPUs of '%d' (%u active cpu(s))\n", first_node_id, cpu_count); + ha_diag_notice("Multi-socket cpu detected, automatically binding on active CPUs of '%d' (%u active cpu(s))\n", first_node_id, cpu_count); if (!global.nbthread) global.nbthread = tmax; @@ -1586,9 +1586,9 @@ static int cpu_policy_group_by_cluster(int policy, int tmin, int tmax, int gmin, } if (global.nbthread) - ha_diag_warning("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups); + ha_diag_notice("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups); else - ha_diag_warning("Could not determine any CPU cluster\n"); + ha_diag_notice("Could not determine any CPU cluster\n"); return 0; } @@ -1684,9 +1684,9 @@ static int cpu_policy_group_by_ccx(int policy, int tmin, int tmax, int gmin, int } if (global.nbthread) - ha_diag_warning("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups); + ha_diag_notice("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups); else - ha_diag_warning("Could not determine any CPU cluster\n"); + ha_diag_notice("Could not determine any CPU cluster\n"); return 0; }