mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
BUG/MEDIUM: proxy: properly stop backends on soft-stop
On soft-stop, we must properlu stop backends and not only proxies with at
least a listener. This is mandatory in order to stop the health checks. A
previous fix was provided to do so (ba29687bc1
"BUG/MEDIUM: proxy: properly
stop backends"). However, only stop_proxy() function was fixed. When HAproxy
is stopped, this function is no longer used. So the same kind of fix must be
done on do_soft_stop_now().
This patch partially fixes the issue #1874. It must be backported as far as
2.4.
This commit is contained in:
parent
7716f27736
commit
48678e483f
10
src/proxy.c
10
src/proxy.c
@ -2198,6 +2198,7 @@ struct task *hard_stop(struct task *t, void *context, unsigned int state)
|
|||||||
/* perform the soft-stop right now (i.e. unbind listeners) */
|
/* perform the soft-stop right now (i.e. unbind listeners) */
|
||||||
static void do_soft_stop_now()
|
static void do_soft_stop_now()
|
||||||
{
|
{
|
||||||
|
struct proxy *p;
|
||||||
struct task *task;
|
struct task *task;
|
||||||
|
|
||||||
/* disable busy polling to avoid cpu eating for the new process */
|
/* disable busy polling to avoid cpu eating for the new process */
|
||||||
@ -2227,6 +2228,15 @@ static void do_soft_stop_now()
|
|||||||
|
|
||||||
thread_release();
|
thread_release();
|
||||||
|
|
||||||
|
/* Loop on proxies to stop backends */
|
||||||
|
p = proxies_list;
|
||||||
|
while (p) {
|
||||||
|
HA_RWLOCK_WRLOCK(PROXY_LOCK, &p->lock);
|
||||||
|
proxy_cond_disable(p);
|
||||||
|
HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &p->lock);
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
|
||||||
/* signal zero is used to broadcast the "stopping" event */
|
/* signal zero is used to broadcast the "stopping" event */
|
||||||
signal_handler(0);
|
signal_handler(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user