]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: mux-h2: Properly handle connection error during preface sending
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Jun 2025 14:23:39 +0000 (16:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Jun 2025 14:48:00 +0000 (16:48 +0200)
commit5ba0a2d5270f2ba52a3022578e52fb5709bff3cb
treead76beb422fc963b124425c75bc6784849627062
parenta2a142bf40c76114cf85dfe1f48d7b14ec70ad5f
BUG/MEDIUM: mux-h2: Properly handle connection error during preface sending

On backend side, an error at connection level during the preface sending was
not properly handled and could lead to a spinning loop on process_stream()
when the h2 stream on client side was blocked, for instance because of h2
flow control.

It appeared that no transition was perfromed from the PREFACE state to an
ERROR state on the H2 connection when an error occurred on the underlying
connection. In that case, the H2 connection was woken up in loop to try to
receive data, waking up the upper stream at the same time.

To fix the issue, an H2C error must be reported. Most state transitions are
handled by the demux function. So it is the right place to do so. First, in
PREFACE state and on server side, if an error occurred on the TCP
connection, an error is now reported on the H2 connection. REFUSED_STREAM
error code is used in that case. In addition, in that case, we also take
care to properly handle the connection shutdown.

This patch should fix the issue #3020. It must be backported to all stable
versions.
src/mux_h2.c