]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: queues: Adjust the proxy counters when appropriate
authorOlivier Houchard <cognet@ci0.org>
Thu, 9 Jan 2025 16:43:41 +0000 (17:43 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 9 Jan 2025 16:46:46 +0000 (17:46 +0100)
In process_srv_queue(), if we manage to successfully run an extra task,
don't forget to adjust the proxy's totpend and served counters accordingly.
Having an inaccurate served could lead to various subtle bugs, as it is
used when making load balancing decisions.

This should not be backported, unless cda7275ef5d5e49fb2ea2373ea3b1ba63fc927c3
is backported too.

src/queue.c

index 7c27e39ed968c7376e82877dfe88cb149623d907..8e532e6e96aca610d421b2d6445ed6969803101a 100644 (file)
@@ -452,8 +452,11 @@ int process_srv_queue(struct server *s)
                 * checked, but before we set ready_srv so it would not see it,
                 * just in case try to run one more stream.
                 */
-               if (pendconn_process_next_strm(s, p, px_ok))
+               if (pendconn_process_next_strm(s, p, px_ok)) {
+                       _HA_ATOMIC_SUB(&p->totpend, 1);
+                       _HA_ATOMIC_ADD(&p->served, 1);
                        done++;
+               }
        }
        return done;
 }