From: Willy Tarreau Date: Thu, 21 Nov 2013 10:50:50 +0000 (+0100) Subject: BUG/MEDIUM: checks: fix slow start regression after fix attempt X-Git-Tag: v1.5-dev20~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7b73485d0a2dbf7572f78756234337d1277b46c;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/checks.c b/src/checks.c index 44ad4b7ae3..7269ac9b8f 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1553,6 +1553,20 @@ int start_checks() { */ for (px = proxy; px; px = px->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)) continue; @@ -1576,20 +1590,6 @@ int start_checks() { */ for (px = proxy; px; px = px->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)) continue;