]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: queues: Make sure we call process_srv_queue() when leaving
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 13 Dec 2024 17:11:05 +0000 (17:11 +0000)
committerOlivier Houchard <cognet@ci0.org>
Tue, 17 Dec 2024 15:05:44 +0000 (16:05 +0100)
In stream_free(), make sure we call process_srv_queue() each time we
call sess_change_server(), otherwise a server may end up not dequeuing
any stream when it could do so. In some extreme cases it could lead to
an infinite loop, as the server would appear to be available, as its
"served" parameter would be < maxconn, but would end up not being used,
as there are elements still in its queue.

This should be backported up to 2.6.

src/stream.c

index 6e6a54555a82ff37acc4d2c64abf95dee50229e4..73c182b686108b60d4f438cbb70dc5fd99a53d6e 100644 (file)
@@ -628,11 +628,14 @@ void stream_free(struct stream *s)
        }
 
        if (unlikely(s->srv_conn)) {
+               struct server *oldsrv = s->srv_conn;
                /* the stream still has a reserved slot on a server, but
                 * it should normally be only the same as the one above,
                 * so this should not happen in fact.
                 */
                sess_change_server(s, NULL);
+               if (may_dequeue_tasks(oldsrv, s->be))
+                       process_srv_queue(oldsrv);
        }
 
        /* We may still be present in the buffer wait queue */