]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 20 Nov 2026 13:29:45 +0000 (14:29 +0100)
committerOlivier Houchard <cognet@ci0.org>
Fri, 20 Nov 2026 14:06:33 +0000 (15:06 +0100)
commit830bbaa7ad28da86afb7c47a457d76e224d51704
tree63e5d10983bc36077bcc54ee8790865a8d9985ca
parentb6184befb72ec14d5fa478a3ce8f0b0866918f89
BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream

When h2c_dec_hdrs() fails to allocate the temporary buffer used to
decode the HEADERS frame of a new request, it sets H2_CF_DEM_SALLOC and
the connection is queued in the buffer wait list. But h2_buf_available()
only serves H2_CF_DEM_SALLOC for a stream which has a stream connector,
which is not the case yet, so it never succeeds: the demux remains
blocked and the request is not processed until the connection times
out. This can be reproduced by faking a failed allocation there on the
first request of a connection.

There is no buffer the callback could allocate in this case, so let's
clear the flag and restart the demux, which will retry by itself. Since
b_alloc() refuses to allocate when other entries are queued, the retry
would be queued again and the offered buffer would be lost for
everyone, so a new flag H2_CF_DEM_MAYALLOC is set to let the next
h2_get_buf() allocate with DB_F_NOQUEUE, as mux-h1 does with
H1C_F_IN_MAYALLOC.

This was introduced in 2.0 by commit 5c8cafae3 ("MEDIUM: mux-h2: decode
HEADERS frames before allocating the stream"). It must be backported to
all supported versions. Before 3.0 there is no DB_F_NOQUEUE and the new
flag is not needed, clearing H2_CF_DEM_SALLOC and restarting the demux
is enough.
include/haproxy/mux_h2-t.h
src/mux_h2.c