From cea8537efdd8306742cda30faafb03732567a6ae Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 29 Nov 2017 14:49:30 +0100 Subject: [PATCH] BUG/MEDIUM: threads/peers: decrement, not increment jobs on quitting Commit 8d8aa0d ("MEDIUM: threads/listeners: Make listeners thread-safe") mistakenly placed HA_ATOMIC_ADD(job, 1) to replace a job--, so it maintains the job count too high preventing the process from cleanly exiting on reload. This needs to be backported to 1.8. --- src/peers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peers.c b/src/peers.c index d8542415f..7580742f7 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2102,7 +2102,7 @@ static struct task *process_peer_sync(struct task * task) if (ps->flags & PEER_F_TEACH_COMPLETE) { if (peers->flags & PEERS_F_DONOTSTOP) { /* resync of new process was complete, current process can die now */ - HA_ATOMIC_ADD(&jobs, 1); + HA_ATOMIC_SUB(&jobs, 1); peers->flags &= ~PEERS_F_DONOTSTOP; for (st = ps->tables; st ; st = st->next) st->table->syncing--;