From: Amaury Denoyelle Date: Mon, 30 Nov 2026 14:03:04 +0000 (+0100) Subject: BUG/MINOR: mux-quic: always notify stream upper layer on reset X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=317447675603f11a608c1dfd80ca3066f03fc126;p=haproxy.git BUG/MINOR: mux-quic: always notify stream upper layer on reset Function qcc_reset_stream() is used when the stream is reset prematurely. Along the RESET_STREAM emission, it also notifies the stream upper layer, so that the error is transferred to the other MUX side. Previously, the function was skipped if the stream was already locally closed, as RESET_STREAM is unnecessary in this case. However, this causes an issue on the backend side as the call is skipped if the request is already transferred. The error is thus not reported on the other side and the client will be left waiting until the server timeout is hit. On the frontend side, impact is much more limited. If the stream is locally closed, the server has already transmitted its response and is no longer waiting. The only user-visible change is on haproxy stream termination log, with a possible client abort (C---) now reported. Fix this by adjusting qcc_reset_stream() so that, when the stream is locally closed, upper-layer notification is still executed even though the RESET_STREAM emission is skipped. To ensure notification is only performed once, an additionnal check is performed to skip it if SE_FL_ERROR or SE_FL_ERR_PENDING is already set. As a side-effect, this prevents the termination event code from being overwritten. This must be backported up to 3.3 after a period of observation, as this is mainly an issue on the backend side. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index 52e6c1a8e..9ef88c277 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1808,17 +1808,27 @@ static void _qcc_send_stream(struct qcs *qcs, int urg) } } -/* Prepare for the emission of RESET_STREAM on with error code . If - * is non null, it is used as a stream level termination event code. +/* Prepare for the emission of RESET_STREAM on with error code and + * notify stream upper layer. If is non null, it is used as the stream + * level termination event code. */ void qcc_reset_stream(struct qcs *qcs, int err, int tevt) { struct qcc *qcc = qcs->qcc; const uint64_t diff = qcs_prep_bytes(qcs); - if ((qcs->flags & QC_SF_TO_RESET) || qcs_is_close_local(qcs)) + /* early return if stream reset was already performed */ + if (qcs->flags & QC_SF_TO_RESET) return; + /* RS is unneeded if stream is already locally closed. Upper layer + * still needs to be notified. + */ + if (qcs_is_close_local(qcs)) { + TRACE_DEVEL("RS emission skipped", QMUX_EV_QCS_END, qcc->conn, qcs); + goto out; + } + /* TODO if QCS waiting for buffer, it could be removed from * if sending is closed now. */ @@ -1854,16 +1864,17 @@ void qcc_reset_stream(struct qcs *qcs, int err, int tevt) qcs->tx.fc.off_soft = qcs->tx.fc.off_real; } + _qcc_send_stream(qcs, 1); + tasklet_wakeup(qcc->wait_event.tasklet); + + out: /* Report send error to stream-endpoint layer. */ - if (qcs_sc(qcs)) { + if (qcs_sc(qcs) && !se_fl_test(qcs->sd, SE_FL_ERROR|SE_FL_ERR_PENDING)) { se_fl_set_error(qcs->sd); if (tevt) se_report_term_evt(qcs->sd, tevt); qcs_alert(qcs); } - - _qcc_send_stream(qcs, 1); - tasklet_wakeup(qcc->wait_event.tasklet); } /* Register stream for STREAM emission. Set to 1 if stream content