]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: quic: never advertise more streams than configured
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 18 Nov 2026 16:52:44 +0000 (17:52 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 18 Nov 2026 16:41:42 +0000 (17:41 +0100)
With "tune.streams-elasticity", the initial max-streams-bidi transport
parameter is set to conn_calc_max_streams() of the configured limit,
i.e. the lowest of "tune.quic.fe.stream.max-concurrent" and
"tune.quic.fe.stream.max-total". But this function may return more than
the value it is passed, as it also considers the share of the extra
streams budget left for each remaining connection, which does not depend
on it: with "tune.streams-elasticity 1000", it returns 10 at low load.

When "tune.quic.fe.stream.max-total" is lower than this, releasing the
first remote stream hits BUG_ON(qcc->lfctl.ms_bidi > max) in
qcc_release_remote_stream(), so the process dies on the first completed
request.

Let's not advertise more than the configured limit. The stream_max_total
reg-test now enables stream elasticity to cover this.

This was introduced by commit d21ec4c70 ("MINOR: quic: use stream
elasticity value for initial advertisement") in 3.4-dev13 and must be
backported to 3.4.

reg-tests/quic/stream_max_total.vtc
src/quic_tp.c

index 1b7c1dd8760631801f3a088b504ba9cdcba5b126..c86f55ba211f37d1cd572b3fe967a4fab53769ad 100644 (file)
@@ -7,6 +7,8 @@ feature cmd "$HAPROXY_PROGRAM -cc 'feature(QUIC) && !feature(QUIC_OPENSSL_COMPAT
 haproxy ha_qsrv -conf {
        global
                tune.quic.fe.stream.max-total 3
+               # must not grant more streams than max-total
+               tune.streams-elasticity 1000
 
        defaults
                mode http
index 1b6d1015ffa58d200b9626751d48b1cf1c6acbee..0f3b5fcb2b6db3696447a8ff52917ab78d76200b 100644 (file)
@@ -879,7 +879,8 @@ int qc_lstnr_params_init(struct quic_conn *qc,
         */
        if (global.tune.streams_elasticity && !qc->li->bind_conf->ssl_conf.early_data) {
                rx_params->initial_max_streams_bidi =
-                 conn_calc_max_streams(rx_params->initial_max_streams_bidi);
+                 MIN(rx_params->initial_max_streams_bidi,
+                     conn_calc_max_streams(rx_params->initial_max_streams_bidi));
        }
 
        return 1;