]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: filters: Don't propagate a close while a filter waits on a channel
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 23 Oct 2026 16:33:29 +0000 (18:33 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 23 Oct 2026 17:43:38 +0000 (19:43 +0200)
commit86119aad3b44b1b5abec4990286eb298d265d560
tree5f2d35f3b7eacb8c628399fad5adb633d5dc4e06
parent0023120796cc86c7ea685c05a79607245e1e5459
BUG/MEDIUM: filters: Don't propagate a close while a filter waits on a channel

When a filter asks to wait during the analysis of a channel, with
filter.WAIT, all the data it holds are kept in the buffer, waiting to be
processed when it is called back. But a close could be propagated to the
other side in the meantime: when a shutdown or an abort was received on
the channel, the close was forwarded to the peer side, for instance a
backend EOF was immediately forwarded to the client. The stream could
then terminate before the filter resumed, and the held data were lost,
typically a complete response held by lua filters waiting for their
wake-up, delivered with no framing and delimited by the backend close.

So now, when a filter asks to wait, the close is no longer propagated:
like the connection on the request side, the channel keeps the
CF_AUTO_CLOSE flag cleared while a filter waits on it. The flag is
restored by the analyzers on each pass, so the close is simply deferred
until the filter resumes, and nothing changes for the streams without
filters waiting.

The "lua-eof" reg-test, introduced to record this race and marked broken
until it was fixed, now passes and is un-broken. It exercises both the
legacy filter chains and the filter instance mode, with a keep-alive
connection reuse.

This patch should be backported to all supported version after a perido of
observation.
reg-tests/filters/lua-eof.vtc
src/filters.c