mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 07:24:32 +00:00
[CRITICAL] fix server state tracking: it was O(n!) instead of O(n)
Using the wrong operator (&& instead of &) causes DOWN->UP transition to take longer than it should and to produce a lot of redundant logs. With typical "track" usage (1-6 tracking servers) it shouldn't make a big difference but for heavily tracked servers this bug leads to hang with 100% CPU usage and extremely big log spam.
This commit is contained in:
parent
0b9c02c861
commit
f39c71c981
@ -161,7 +161,7 @@ static void set_server_down(struct server *s)
|
||||
|
||||
s->down_trans++;
|
||||
|
||||
if (s->state && SRV_CHECKED)
|
||||
if (s->state & SRV_CHECKED)
|
||||
for(srv = s->tracknext; srv; srv = srv->tracknext)
|
||||
set_server_down(srv);
|
||||
}
|
||||
@ -226,7 +226,7 @@ static void set_server_up(struct server *s) {
|
||||
Warning("%s", trash);
|
||||
send_log(s->proxy, LOG_NOTICE, "%s", trash);
|
||||
|
||||
if (s->state && SRV_CHECKED)
|
||||
if (s->state & SRV_CHECKED)
|
||||
for(srv = s->tracknext; srv; srv = srv->tracknext)
|
||||
set_server_up(srv);
|
||||
}
|
||||
@ -277,7 +277,7 @@ static void set_server_disabled(struct server *s) {
|
||||
if (!s->proxy->srv_bck && !s->proxy->srv_act)
|
||||
set_backend_down(s->proxy);
|
||||
|
||||
if (s->state && SRV_CHECKED)
|
||||
if (s->state & SRV_CHECKED)
|
||||
for(srv = s->tracknext; srv; srv = srv->tracknext)
|
||||
set_server_disabled(srv);
|
||||
}
|
||||
@ -317,7 +317,7 @@ static void set_server_enabled(struct server *s) {
|
||||
Warning("%s", trash);
|
||||
send_log(s->proxy, LOG_NOTICE, "%s", trash);
|
||||
|
||||
if (s->state && SRV_CHECKED)
|
||||
if (s->state & SRV_CHECKED)
|
||||
for(srv = s->tracknext; srv; srv = srv->tracknext)
|
||||
set_server_enabled(srv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user