From: Willy Tarreau Date: Wed, 29 Nov 2017 13:49:30 +0000 (+0100) Subject: BUG/MEDIUM: threads/peers: decrement, not increment jobs on quitting X-Git-Tag: v1.9-dev1~640 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cea8537efdd8306742cda30faafb03732567a6ae;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/peers.c b/src/peers.c index d8542415fd..7580742f7d 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--;