From d9c6ef0a4abfcb7e84e91204e8882c86cd6f68c8 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 10 Oct 2008 17:51:34 +0200 Subject: [PATCH] [BUG] do not try to pause backends during reload During a configuration reload, haproxy tried to pause all proxies. Unfortunately, it also tried to pause backends, which would fail and cause trouble to the new process since the port was still bound. --- src/proxy.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/proxy.c b/src/proxy.c index 83ef1d599..7fe78c785 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -353,8 +353,8 @@ void soft_stop(void) tv_now(&now); /* else, the old time before select will be used */ while (p) { if (p->state != PR_STSTOPPED) { - Warning("Stopping proxy %s in %d ms.\n", p->id, p->grace); - send_log(p, LOG_WARNING, "Stopping proxy %s in %d ms.\n", p->id, p->grace); + Warning("Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace); + send_log(p, LOG_WARNING, "Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace); tv_ms_add(&p->stop_time, &now, p->grace); } p = p->next; @@ -401,16 +401,17 @@ void pause_proxies(void) p = proxy; tv_now(&now); /* else, the old time before select will be used */ while (p) { - if (p->state != PR_STERROR && + if (p->cap & PR_CAP_FE && + p->state != PR_STERROR && p->state != PR_STSTOPPED && p->state != PR_STPAUSED) { - Warning("Pausing proxy %s.\n", p->id); - send_log(p, LOG_WARNING, "Pausing proxy %s.\n", p->id); + Warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id); + send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id); pause_proxy(p); if (p->state != PR_STPAUSED) { err |= 1; - Warning("Proxy %s failed to enter pause mode.\n", p->id); - send_log(p, LOG_WARNING, "Proxy %s failed to enter pause mode.\n", p->id); + Warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id); + send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id); } } p = p->next; @@ -437,8 +438,8 @@ void listen_proxies(void) tv_now(&now); /* else, the old time before select will be used */ while (p) { if (p->state == PR_STPAUSED) { - Warning("Enabling proxy %s.\n", p->id); - send_log(p, LOG_WARNING, "Enabling proxy %s.\n", p->id); + Warning("Enabling %s %s.\n", proxy_cap_str(p->cap), p->id); + send_log(p, LOG_WARNING, "Enabling %s %s.\n", proxy_cap_str(p->cap), p->id); for (l = p->listen; l != NULL; l = l->next) { if (listen(l->fd, p->backlog ? p->backlog : p->maxconn) == 0) { @@ -456,10 +457,10 @@ void listen_proxies(void) else port = ntohs(((struct sockaddr_in *)(&l->addr))->sin_port); - Warning("Port %d busy while trying to enable proxy %s.\n", - port, p->id); - send_log(p, LOG_WARNING, "Port %d busy while trying to enable proxy %s.\n", - port, p->id); + Warning("Port %d busy while trying to enable %s %s.\n", + port, proxy_cap_str(p->cap), p->id); + send_log(p, LOG_WARNING, "Port %d busy while trying to enable %s %s.\n", + port, proxy_cap_str(p->cap), p->id); /* Another port might have been enabled. Let's stop everything. */ pause_proxy(p); break;