mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
BUG/MEDIUM: server: unwanted behavior leaving maintenance mode on tracked stopping server
Leaving the maintenance state and if the server remains in stopping mode due to a tracked one: - We mistakenly try to grab some pending conns and shutdown backup sessions. - The proxy down time and last change were also mistakenly updated
This commit is contained in:
parent
2ba672726c
commit
e1e3947e7e
13
src/server.c
13
src/server.c
@ -1183,6 +1183,11 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
if ((!s->track || s->track->next_state != SRV_ST_STOPPED) &&
|
if ((!s->track || s->track->next_state != SRV_ST_STOPPED) &&
|
||||||
(!(s->agent.state & CHK_ST_ENABLED) || (s->agent.health >= s->agent.rise)) &&
|
(!(s->agent.state & CHK_ST_ENABLED) || (s->agent.health >= s->agent.rise)) &&
|
||||||
(!(s->check.state & CHK_ST_ENABLED) || (s->check.health >= s->check.rise))) {
|
(!(s->check.state & CHK_ST_ENABLED) || (s->check.health >= s->check.rise))) {
|
||||||
|
|
||||||
|
if (s->track && s->track->next_state == SRV_ST_STOPPING)
|
||||||
|
s->last_change = now.tv_sec;
|
||||||
|
s->next_state = SRV_ST_STOPPING;
|
||||||
|
else {
|
||||||
if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) {
|
if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) {
|
||||||
if (s->proxy->last_change < now.tv_sec) // ignore negative times
|
if (s->proxy->last_change < now.tv_sec) // ignore negative times
|
||||||
s->proxy->down_time += now.tv_sec - s->proxy->last_change;
|
s->proxy->down_time += now.tv_sec - s->proxy->last_change;
|
||||||
@ -1191,17 +1196,13 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
|
|
||||||
if (s->last_change < now.tv_sec) // ignore negative times
|
if (s->last_change < now.tv_sec) // ignore negative times
|
||||||
s->down_time += now.tv_sec - s->last_change;
|
s->down_time += now.tv_sec - s->last_change;
|
||||||
s->last_change = now.tv_sec;
|
|
||||||
|
|
||||||
if (s->track && s->track->next_state == SRV_ST_STOPPING)
|
s->last_change = now.tv_sec;
|
||||||
s->next_state = SRV_ST_STOPPING;
|
|
||||||
else {
|
|
||||||
s->next_state = SRV_ST_STARTING;
|
s->next_state = SRV_ST_STARTING;
|
||||||
if (s->slowstart > 0)
|
if (s->slowstart > 0)
|
||||||
task_schedule(s->warmup, tick_add(now_ms, MS_TO_TICKS(MAX(1000, s->slowstart / 20))));
|
task_schedule(s->warmup, tick_add(now_ms, MS_TO_TICKS(MAX(1000, s->slowstart / 20))));
|
||||||
else
|
else
|
||||||
s->next_state = SRV_ST_RUNNING;
|
s->next_state = SRV_ST_RUNNING;
|
||||||
}
|
|
||||||
|
|
||||||
server_recalc_eweight(s);
|
server_recalc_eweight(s);
|
||||||
|
|
||||||
@ -1220,6 +1221,8 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
xferred = pendconn_grab_from_px(s);
|
xferred = pendconn_grab_from_px(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (mode & SRV_ADMF_FMAINT) {
|
if (mode & SRV_ADMF_FMAINT) {
|
||||||
chunk_printf(&trash,
|
chunk_printf(&trash,
|
||||||
"%sServer %s/%s is %s/%s (leaving forced maintenance)",
|
"%sServer %s/%s is %s/%s (leaving forced maintenance)",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user