mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: init/threads: continue to limit default thread count to max per group
Jakub Vojacek reported in issue #1955 that haproxy 2.7.0 doesn't start anymore on a 128-CPU machine with a default config. The reason is the raise of the default MAX_THREADS value that came with thread groups. Previously, the maximum number of threads was simply limited to this value, and all of them fit into one group. Now the limit being higher, all threads cannot fit by default into a single group, and haproxy fails to start. The solution adopted here is to continue to limit the number of threads to the max supported per group, but to multiply it by the number of groups (usually 1 by default). In addition, a diag warning is now emitted when this happens, reminding the user to set nbthread or adjust thread-groups. We can hardly do more than a diag warning if we don't want to make the upgrade painful for users. Thanks to Jakub for reporting this early. This must be backported to 2.7.
This commit is contained in:
parent
f648767a4e
commit
400b3ae2d5
@ -2797,6 +2797,16 @@ int check_config_validity()
|
||||
#endif
|
||||
global.nbthread = numa_cores ? numa_cores :
|
||||
thread_cpus_enabled_at_boot;
|
||||
|
||||
/* Note that we cannot have more than 32 or 64 threads per group */
|
||||
if (!global.nbtgroups)
|
||||
global.nbtgroups = 1;
|
||||
|
||||
if (global.nbthread > MAX_THREADS_PER_GROUP * global.nbtgroups) {
|
||||
ha_diag_warning("nbthread not set, found %d CPUs, limiting to %d threads (maximum is %d per thread group). Please set nbthreads and/or increase thread-groups in the global section to silence this warning.\n",
|
||||
global.nbthread, MAX_THREADS_PER_GROUP * global.nbtgroups, MAX_THREADS_PER_GROUP);
|
||||
global.nbthread = MAX_THREADS_PER_GROUP * global.nbtgroups;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user