mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MEDIUM: config: properly compute the default number of processes for a proxy
Chad Lavoie reported an interesting regression caused by the latest updates to automatically detect the processes a peers section runs on. It turns out that if a config has neither nbproc nor a bind-process statement and depending on the frontend->backend chaining, it is possible to evade all bind_proc propagations, resulting in assigning only ~0UL (all processes, which is 32 or 64) without ever restricting it to nbproc. It was not visible in backends until they started to reference peers sections which saw themselves with 64 processes at once. This patch addresses this by replacing all those ~0UL with nbits(nbproc). That way all "bind-process" settings *default* to the number of processes defined in nbproc instead of 32 or 64. This fix could possibly be backported into 1.5, though there is no indication that this bug could have any effect there.
This commit is contained in:
parent
64c5722e05
commit
e428b08ee7
@ -7606,23 +7606,23 @@ out_uri_auth_compat:
|
||||
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
|
||||
unsigned long mask;
|
||||
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : nbits(global.nbproc);
|
||||
curproxy->bind_proc |= mask;
|
||||
}
|
||||
|
||||
if (!curproxy->bind_proc)
|
||||
curproxy->bind_proc = ~0UL;
|
||||
curproxy->bind_proc = nbits(global.nbproc);
|
||||
}
|
||||
|
||||
if (global.stats_fe) {
|
||||
list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
|
||||
unsigned long mask;
|
||||
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
|
||||
mask = bind_conf->bind_proc ? bind_conf->bind_proc : nbits(global.nbproc);
|
||||
global.stats_fe->bind_proc |= mask;
|
||||
}
|
||||
if (!global.stats_fe->bind_proc)
|
||||
global.stats_fe->bind_proc = ~0UL;
|
||||
global.stats_fe->bind_proc = nbits(global.nbproc);
|
||||
}
|
||||
|
||||
/* propagate bindings from frontends to backends. Don't do it if there
|
||||
@ -7639,7 +7639,7 @@ out_uri_auth_compat:
|
||||
for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
|
||||
if (curproxy->bind_proc)
|
||||
continue;
|
||||
curproxy->bind_proc = ~0UL;
|
||||
curproxy->bind_proc = nbits(global.nbproc);
|
||||
}
|
||||
|
||||
/*******************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user