]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: threads: Initialize maxthrpertgroup earlier.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 6 Feb 2026 01:49:26 +0000 (02:49 +0100)
committerOlivier Houchard <ohouchard@haproxy.com>
Fri, 6 Feb 2026 02:01:36 +0000 (03:01 +0100)
Give global.maxthrpertgroup its default value at global creation,
instead of later when we're trying to detect the thread count.
It is used when verifying the configuration file validity, and if it was
not set in the config file, in a few corner cases, the value of 0 would
be used, which would then reject perfectly fine configuration files.

This should be backported to 3.3.

src/haproxy.c
src/thread.c

index 1ad4c58f84158bfaa89b6ee854795be85dbaac5d..99341730a47e3e0753031e603e2e92c8287173b9 100644 (file)
@@ -205,6 +205,7 @@ struct global global = {
 #endif
        /* by default allow clients which use a privileged port for TCP only */
        .clt_privileged_ports = HA_PROTO_TCP,
+       .maxthrpertgroup = MAX_THREADS_PER_GROUP,
        /* others NULL OK */
 };
 
index c156d84e5ac1be89ef483392a7901534cb86e12c..e10e32dbdc116034d7e13f358f3ace2870105e52 100644 (file)
@@ -1641,9 +1641,6 @@ void thread_detect_count(void)
        if (global.nbtgroups)
                grp_min = grp_max = global.nbtgroups;
 
-       if (!global.maxthrpertgroup)
-               global.maxthrpertgroup = MAX_THREADS_PER_GROUP;
-
 #if defined(USE_THREAD)
        /* Adjust to boot settings if not forced */
        if (thr_min <= thread_cpus_enabled_at_boot && thread_cpus_enabled_at_boot < thr_max)