From: Christopher Faulet Date: Tue, 10 Nov 2026 15:16:25 +0000 (+0100) Subject: MINOR: mux-spop: don't add a closing connection to an idle list on detach X-Git-Url: https://git.kaiwu.me/%7B@url%7D?a=commitdiff_plain;h=5c5f025dce37c01a40cce7189995b518255efb2b;p=haproxy.git MINOR: mux-spop: don't add a closing connection to an idle list on detach In spop_detach(), the test deciding whether the connection may be moved to an idle list checks SPOP_CF_RCVD_SHUT, SPOP_CF_ERR_PENDING and SPOP_CF_ERROR, but not the connection state. A connection that already switched to SPOP_CS_ERROR, SPOP_CS_CLOSING or SPOP_CS_CLOSED may thus be inserted in the session server list or in the server's idle pool, while spop_avail_streams() reports no available stream for it. This can only happen with a private connection, since srv_add_to_idle_list() already rejects connections without available streams. It is not harmful either, since session_get_conn() also requires an available stream, so such a connection is never reused. But it is still wrong to park it: it prevents the session from dropping it and forces a useless idle counter increment. This is the same fix as the one applied on mux-fcgi by commit 2acf116bf ("MINOR: mux-fcgi: don't add a closed connection to an idle list on detach"). Unlike FCGI, all states from SPOP_CS_ERROR are excluded, which matches the test performed by spop_avail_streams(). This may be backported to 3.1. --- diff --git a/src/mux_spop.c b/src/mux_spop.c index a742c930e..06daaa7b9 100644 --- a/src/mux_spop.c +++ b/src/mux_spop.c @@ -3024,7 +3024,8 @@ static void spop_detach(struct sedesc *sd) /* A stream left, refresh the timeout if necessary. */ spop_conn_update_timeout(spop_conn); - if (!(spop_conn->flags & (SPOP_CF_RCVD_SHUT|SPOP_CF_ERR_PENDING|SPOP_CF_ERROR))) { + if (!(spop_conn->flags & (SPOP_CF_RCVD_SHUT|SPOP_CF_ERR_PENDING|SPOP_CF_ERROR)) && + (spop_conn->state < SPOP_CS_ERROR)) { if (spop_conn->conn->flags & CO_FL_PRIVATE) { /* Add the connection in the session server list, if not already done */ session_add_conn(sess, spop_conn->conn);