From: Christopher Faulet Date: Fri, 13 Nov 2026 09:02:36 +0000 (+0100) Subject: BUG/MEDIUM: mux-h1: Report EOS when a demux error is handled by the app layer X-Git-Url: https://git.kaiwu.me/ngx_http_access_module.html?a=commitdiff_plain;h=cf5e36d9d618d1e417343b61be627c73d12964f8;p=haproxy.git BUG/MEDIUM: mux-h1: Report EOS when a demux error is handled by the app layer Since 30ca6e01 ("BUG/MEDIUM: mux-h1: Don't close the connection on a payload parsing error"), a demux error is reported as EOI on the SE when the stream connector is still attached, leaving the app layer handle the error via the htx flags and the termination events. But this is not enough for consumers waiting for more data, such as health checks: tcpcheck_eval_recv() loops while neither EOS nor ERROR is reported, and the mux does not provide any data anymore after a demux error. Thus a health check waits until its timeout and reports an L7TOUT instead of an immediate invalid response. This is especially annoying because a server returning random data instead of a valid HTTP response is reported as a timeout. To fix the bug, SE_FL_EOS is now also reported on the SE. It does not carry the error itself, which is still reported via the termination events and consumed via the HTX flags. It only reports that no more data will be received, which is true because the demux error is sticky. This is also what mux-h2 does (h2s_propagate_term_flags()). The 400-response path in streams is preserved because the close forwarding is gated by SC_FL_NOHALF, which is never set on the front stream connector. This fix must be backported as far as 2.6, but without 30ca6e01, which is not needed on older versions. There, the demux error is always reported as EOI on the SE and SE_FL_ERROR is never set. On 3.0 and 2.8, SE_FL_EOS is only reported when there is no stream connector attached to the h1s, it must also be reported when the stream connector is still attached. On 2.6, SE_FL_EOS is never reported, it must be set in addition to SE_FL_EOI. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 55115878b..6f9a4b69b 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2530,9 +2530,9 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count TRACE_DEVEL("leaving on error, SE released", H1_EV_RX_DATA|H1_EV_STRM_ERR, h1c->conn, h1s); } else { - /* The app layer owns the error via htx flags: only report EOI. */ - se_fl_set(h1s->sd, SE_FL_EOI); - TRACE_DEVEL("leaving on error, EOI reported to the SE", H1_EV_RX_DATA|H1_EV_STRM_ERR, h1c->conn, h1s); + /* The app layer owns the error via htx flags: report EOI/EOS */ + se_fl_set(h1s->sd, SE_FL_EOI|SE_FL_EOS); + TRACE_DEVEL("leaving on error, EOI/EOS reported to the SE", H1_EV_RX_DATA|H1_EV_STRM_ERR, h1c->conn, h1s); } return 0; }