BUG/MEDIUM: threads: Differ checking the max threads per group number

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.
This commit is contained in:
Olivier Houchard 2026-02-06 02:59:14 +01:00
parent 9766211cf0
commit bf7a2808fc

View 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;
}