BUG/MEDIUM: checks: fix slow start regression after fix attempt

Commit 2e99390 (BUG/MEDIUM: checks: fix slowstart behaviour when server
tracking is in use) moved the slowstart task initialization within the
health check code and leaves it unset when checks are disabled. The
problem is that it's possible to trigger slowstart from the CLI by
issuing "disable server XXX / enable server XXX" even when checks are
disabled. The result is a crash when trying to wake up the slowstart
task of that server.

Move the task initialization earlier so that it is done even if the
checks are disabled.

This patch should be backported to 1.4 since the commit above was
backported there.
This commit is contained in:
Willy Tarreau 2013-11-21 11:50:50 +01:00
parent c3916a7fca
commit e7b73485d0

View File

@ -1553,6 +1553,20 @@ int start_checks() {
*/ */
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
for (s = px->srv; s; s = s->next) { for (s = px->srv; s; s = s->next) {
if (s->slowstart) {
if ((t = task_new()) == NULL) {
Alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
return -1;
}
/* We need a warmup task that will be called when the server
* state switches from down to up.
*/
s->warmup = t;
t->process = server_warmup;
t->context = s;
t->expire = TICK_ETERNITY;
}
if (!(s->state & SRV_CHECKED)) if (!(s->state & SRV_CHECKED))
continue; continue;
@ -1576,20 +1590,6 @@ int start_checks() {
*/ */
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
for (s = px->srv; s; s = s->next) { for (s = px->srv; s; s = s->next) {
if (s->slowstart) {
if ((t = task_new()) == NULL) {
Alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
return -1;
}
/* We need a warmup task that will be called when the server
* state switches from down to up.
*/
s->warmup = t;
t->process = server_warmup;
t->context = s;
t->expire = TICK_ETERNITY;
}
if (!(s->state & SRV_CHECKED)) if (!(s->state & SRV_CHECKED))
continue; continue;