]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: threads: Differ checking the max threads per group number
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 6 Feb 2026 01:59:14 +0000 (02:59 +0100)
committerOlivier Houchard <ohouchard@haproxy.com>
Fri, 6 Feb 2026 02:01:50 +0000 (03:01 +0100)
Differ checking the max threads per group number until we're done
parsing the configuration file, as it may be set after a "thread-group-
directive. Otherwise the default value of 64 will be used, even if there
is a max-threads-per-group directive.

This should be backported to 3.3.

src/thread.c

index e10e32dbdc116034d7e13f358f3ace2870105e52..7e27ad0097c4d5c38aebcada03c00753542c29a6 100644 (file)
@@ -1394,6 +1394,12 @@ int thread_map_to_groups()
        for (g = 0; g < global.nbtgroups; g++) {
                if (!ha_tgroup_info[g].count)
                        ug++;
+               else {
+                       if (ha_tgroup_info[g].count > global.maxthrpertgroup) {
+                               ha_alert("thread-group %d assigned too many threads (%d, max=%d)\n", g, ha_tgroup_info[g].count, global.maxthrpertgroup);
+                               return -1;
+                       }
+               }
                ha_tgroup_info[g].tgid_bit = 1UL << g;
        }
 
@@ -2135,11 +2141,6 @@ static int cfg_parse_thread_group(char **args, int section_type, struct proxy *c
                return -1;
        }
 
-       if (ha_tgroup_info[tgroup-1].count > global.maxthrpertgroup) {
-               memprintf(err, "'%s %ld' assigned too many threads (%d, max=%d)", args[0], tgroup, tot, global.maxthrpertgroup);
-               return -1;
-       }
-
        return 0;
 }