]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: h3: do not wait after Tx realloc failure
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 23 Oct 2026 09:22:48 +0000 (11:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 23 Oct 2026 09:36:55 +0000 (11:36 +0200)
The following commit implements for QUIC transcoders a realloc operation
when a smallbuf is not sufficient to encode headers. This is available
via qcc_realloc_stream_txbuf() function.

  0d6112b40b20f9eea0cf38dc304bc1155b673588
  MINOR: mux-quic: retry after small buf alloc failure

However, an alloc failure of this function was considered as a transient
error, with 0 returned in this case. Fix this so that it is now a fatal
error which will trigger the connection closure, which is the correct
handling for memory allocation issues in QUIC MUX layer.

This must be backported up to 3.2. Note that the chunk relative to
h3_req_headers_send() is specific for QUIC backend usage and must only
be picked on 3.3 and above.

src/h3.c

index 9516a15794cfa68838e8d14a5aa2782e48637a0e..7510a0a04ca0ffac7aaf3972b3d039d48da323b2 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -2499,7 +2499,8 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx, char *fin)
        res = smallbuf ? qcc_get_stream_txbuf(qcs, &err, 1) :
                         qcc_realloc_stream_txbuf(qcs);
        if (!res) {
-               if (err) {
+               /* detect alloc failure for qcc_get_stream_txbuf() / qcc_realloc_stream_txbuf() */
+               if (!smallbuf || err) {
                        TRACE_ERROR("cannot allocate Tx buffer", H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, qcs);
                        goto err;
                }
@@ -2775,7 +2776,8 @@ static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx, char *fin)
        res = smallbuf ? qcc_get_stream_txbuf(qcs, &err, 1) :
                         qcc_realloc_stream_txbuf(qcs);
        if (!res) {
-               if (err) {
+               /* detect alloc failure for qcc_get_stream_txbuf() / qcc_realloc_stream_txbuf() */
+               if (!smallbuf || err) {
                        TRACE_ERROR("cannot allocate Tx buffer", H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, qcs);
                        goto err;
                }