]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listeners: count unstoppable jobs on creation, not deletion
authorWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 16:25:14 +0000 (18:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 16:25:14 +0000 (18:25 +0200)
We have to count unstoppable jobs which correspond to worker sockpairs, in
order to know when to count. However the way it's currently done is quite
awkward because these are counted when stopping making the stop mechanism
non-idempotent. This is definitely something we want to fix before stopping
by protocol or our listeners count will quickly go wrong. Now they are
counted when the listeners are created.

src/cli.c
src/proxy.c

index b331bd3e51b40f76d424a224487741a0b168812f..90320c2e92ce5898a7d86557fa620b664f5f3b4c 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2669,6 +2669,7 @@ int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc)
                l->accept = session_accept_fd;
                l->default_target = global.stats_fe->default_target;
                l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
+               HA_ATOMIC_ADD(&unstoppable_jobs, 1);
                /* it's a sockpair but we don't want to keep the fd in the master */
                l->rx.flags &= ~RX_F_INHERITED;
                l->nice = -64;  /* we want to boost priority for local stats */
index 7b000bb239f44ba45bcdf410dafcec6edba84784..058e33131bf6a8d4adb5b2be0f7c9655a1417662 100644 (file)
@@ -1301,10 +1301,8 @@ void stop_proxy(struct proxy *p)
        HA_SPIN_LOCK(PROXY_LOCK, &p->lock);
 
        list_for_each_entry(l, &p->conf.listeners, by_fe) {
-               if (l->options & LI_O_NOSTOP) {
-                       HA_ATOMIC_ADD(&unstoppable_jobs, 1);
+               if (l->options & LI_O_NOSTOP)
                        continue;
-               }
 
                /* There are several cases where we must not close an FD:
                 *   - we're starting up and we have socket transfers enabled;