mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
BUG/MEDIUM: proxy: ignore stopped peers
Since commit f83d3fe
("MEDIUM: init: stop any peers section not bound
to the correct process"), it is possible to stop unused peers on certain
processes. The problem is that the pause/resume/stop functions are not
aware of this and will pass a NULL proxy pointer to the respective
functions, resulting in segfaults in unbound processes during soft
restarts.
Properly check that the peers' frontend is still valid before calling
them.
This bug also affects 1.5 so the fix must be backported. Note that this
fix is not enough to completely get rid of the segfault, the next one
is needed as well.
This commit is contained in:
parent
61add3c064
commit
337a666572
11
src/proxy.c
11
src/proxy.c
@ -937,7 +937,8 @@ void soft_stop(void)
|
||||
|
||||
prs = peers;
|
||||
while (prs) {
|
||||
stop_proxy((struct proxy *)prs->peers_fe);
|
||||
if (prs->peers_fe)
|
||||
stop_proxy(prs->peers_fe);
|
||||
prs = prs->next;
|
||||
}
|
||||
/* signal zero is used to broadcast the "stopping" event */
|
||||
@ -1071,8 +1072,8 @@ void pause_proxies(void)
|
||||
|
||||
prs = peers;
|
||||
while (prs) {
|
||||
p = prs->peers_fe;
|
||||
err |= !pause_proxy(p);
|
||||
if (prs->peers_fe)
|
||||
err |= !pause_proxy(prs->peers_fe);
|
||||
prs = prs->next;
|
||||
}
|
||||
|
||||
@ -1105,8 +1106,8 @@ void resume_proxies(void)
|
||||
|
||||
prs = peers;
|
||||
while (prs) {
|
||||
p = prs->peers_fe;
|
||||
err |= !resume_proxy(p);
|
||||
if (prs->peers_fe)
|
||||
err |= !resume_proxy(prs->peers_fe);
|
||||
prs = prs->next;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user