From d1a33e35fb33b990217ae0652cbc6b322e49d31b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 4 Oct 2012 00:14:33 +0200 Subject: [PATCH] BUG/MEDIUM: proxy: must not try to stop disabled proxies upon reload MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hervé Commowick reported an issue : haproxy dies in a segfault during a soft restart if it tries to pause a disabled proxy. This is because disabled proxies have no management task so we must not wake the task up. This could easily remain unnoticed since the old process was expected to go away, so having it go away faster was not really troubling. However, with sync peers, it is obvious that there is no peer sync during this reload. This issue has been introduced in 1.5-dev7 with the removal of the maintain_proxies() function. No backport is needed. --- include/types/proxy.h | 2 +- src/proxy.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/types/proxy.h b/include/types/proxy.h index 5c078d9e49..641bc1c7ba 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -325,7 +325,7 @@ struct proxy { struct list listener_queue; /* list of the temporarily limited listeners because of lack of a proxy resource */ struct stktable table; /* table for storing sticking sessions */ - struct task *task; /* the associated task, mandatory to manage rate limiting, stopping and resource shortage */ + struct task *task; /* the associated task, mandatory to manage rate limiting, stopping and resource shortage, NULL if disabled */ int grace; /* grace time after stop request */ char *check_req; /* HTTP or SSL request to use for PR_O_HTTP_CHK|PR_O_SSL3_CHK */ int check_len; /* Length of the HTTP or SSL3 request */ diff --git a/src/proxy.c b/src/proxy.c index 8db70b6012..820be2fa5c 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -609,7 +609,8 @@ void soft_stop(void) task_wakeup(p->table.sync_task, TASK_WOKEN_MSG); /* wake every proxy task up so that they can handle the stopping */ - task_wakeup(p->task, TASK_WOKEN_MSG); + if (p->task) + task_wakeup(p->task, TASK_WOKEN_MSG); p = p->next; } -- 2.47.3