]> git.kaiwu.me - haproxy.git/commit
MINOR: mux-fcgi: check for a dead connection before refreshing the timeout
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Nov 2026 09:42:14 +0000 (10:42 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 9 Nov 2026 12:33:52 +0000 (13:33 +0100)
commitb77b044d349e1adb47b243c233751e477d336cb2
treec73c722c08aa703e25c473b5101968cfa2f2a644
parent170a6469cdcaea7ca3d39d9f9bacabae7c183fe8
MINOR: mux-fcgi: check for a dead connection before refreshing the timeout

fcgi_detach() refreshed the connection timeout right after the stream was
destroyed, then evaluated fcgi_conn_is_dead() only at the end of the
function, on the paths that did not already return. So a connection about to
be released was first armed and requeued via task_queue(), then
fcgi_release() cleared its task context and woke it up again for nothing.

Let's evaluate fcgi_conn_is_dead() first, right after the stream is
destroyed, and return early when the connection must be released. The check
that closed the function is then redundant and is removed, and the timeout
is only refreshed for connections that survive.

This only reorders statements: fcgi_conn_update_timeout() writes the task's
expiration date, the FCGI_CF_IDL_PING-like state and the timer queue, none
of which fcgi_conn_is_dead() reads. It also matches the structure mux-h2
just got. The move is safe with regards to the idle lists, since the
branches below only set conn->owner, the session and idle list entries and
the transport idle state, which the predicate does not look at either.

Note that this was only correct once the previous commit removed the
conn->owner test from fcgi_conn_is_dead(): the non-private branch below
clears conn->owner before parking the connection, so evaluating the
predicate first would otherwise report every connection as dead.

This relates to GitHub issue #3558.
src/mux_fcgi.c