]> git.kaiwu.me - haproxy.git/commit
MINOR: mux-fcgi: don't add a closed connection to an idle list on detach
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Nov 2026 09:49:35 +0000 (10:49 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 9 Nov 2026 12:33:52 +0000 (13:33 +0100)
commit2acf116bfa075dd4722801df47cd45a9a0866beb
tree8c9a6270b04eb4b7118628879b4c538ab66cc43a
parentb77b044d349e1adb47b243c233751e477d336cb2
MINOR: mux-fcgi: don't add a closed connection to an idle list on detach

In fcgi_detach(), the test deciding whether the connection may be moved to
an idle list checks FCGI_CF_EOS, FCGI_CF_ERR_PENDING, FCGI_CF_ERROR and
FCGI_CF_KEEP_CONN, but not the connection state. A connection that already
switched to FCGI_CS_CLOSED may thus be inserted in the session server list
or in the server's idle pool, while fcgi_avail_streams() reports no
available stream for it. The stream immediately before, in the same
function, does test FCGI_CS_CLOSED.

This can currently only happen with a private connection, since
srv_add_to_idle_list() already rejects connections without available
streams, and it is not harmful either way: session_get_conn() also
requires an available stream, so such a connection is never reused. But
it is still wrong to park it, since it prevents the session from
dropping it and forces a useless idle counter increment.

Note that fcgi_conn_is_dead() must not be used here: it also requires
FCGI_CF_KEEP_CONN to be cleared or FCGI_CF_ERROR to be set, so it does not
cover every FCGI_CS_CLOSED connection, and the non-private branch below
clears conn->owner before parking the connection.

This may be backported to all supported versions.
src/mux_fcgi.c