]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: queues: Don't forget to unlock the queue before exiting
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 20 Nov 2025 12:51:02 +0000 (13:51 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 20 Nov 2025 12:57:06 +0000 (13:57 +0100)
In assign_server_and_queue(), there's a rare case when the server was
full, so we created a pendconn, another server was considered but in the
meanwhile the pendconn was unqueued already, so we just left the
function. We did so, however, while still holding the queue lock, which
will ultimately lead to a deadlock, and ultimately the watchdog would
kill the process.
To fix that, just unlock the queue before leaving.

This should be backported to 3.2.

src/backend.c

index cac056efb79da314e16f2c1d8594bdb21e6cd5e2..0170547b29274620444471a63937a63102269372 100644 (file)
@@ -1137,6 +1137,7 @@ int assign_server_and_queue(struct stream *s)
 
                                        HA_SPIN_LOCK(QUEUE_LOCK, &p->queue->lock);
                                        if (!p->node.node.leaf_p) {
+                                               HA_SPIN_UNLOCK(QUEUE_LOCK, &p->queue->lock);
                                                /*
                                                 * Okay we've been queued and
                                                 * unqueued already, just leave