From: Amaury Denoyelle Date: Tue, 17 Nov 2026 15:15:48 +0000 (+0100) Subject: BUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return X-Git-Url: https://git.kaiwu.me/http/control.html?a=commitdiff_plain;h=8fc9f0131326ba54a8824fdddaec744299046be9;p=haproxy.git BUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return Previously, qcc_qmux_send_frames() would return 1 in case a send failed on a transient error while nothing was emitted. However, this may trigger a BUG_ON() in qcc_io_send() as this return value is reserved for QUIC pacing support, not relevant with QMux. Fix this by converting the return value to a negative value, which is already used for fatal errors. The caller is responsible for re-emitting the new the frame later. As such, the prepared record is cleared from the send buffer to avoid a duplicate emission on initial flush. Note that this patch does not implement full support for QMux partial emission if the send syscall accepts some but not all bytes, resulting in a partially delivered frame. This must be implemented in a future patch. Once this is the case, all code related to the handling of send zero return can probably be removed. This must be backported up to 3.4. --- diff --git a/src/qcm_qmux.c b/src/qcm_qmux.c index 2a8cdb9e0..5a4e243cf 100644 --- a/src/qcm_qmux.c +++ b/src/qcm_qmux.c @@ -292,8 +292,9 @@ static void qmux_ctrl_send(struct qcs *qcs, uint64_t data) /* Sends list of frames for connection. * - * Returns 0 if all data are emitted or a positive value if sending should be - * retried later. A negative error code is used for a fatal failure. + * Returns 0 if all data are emitted. A negative error code is used for a fatal + * error with CO_FL_ERROR set or a transient error, in which case caller should + * retry later to emit remaining content. */ int qcc_qmux_send_frames(struct qcc *qcc, struct list *frms) { @@ -378,6 +379,10 @@ int qcc_qmux_send_frames(struct qcc *qcc, struct list *frms) TRACE_DEVEL("snd_buf interrupted", QMUX_EV_QCC_SEND, qcc->conn); if (split_frm) LIST_INSERT(frms, &split_frm->list); + /* Remove unsent record from buffer to avoid emitting + * duplicate content during initial flush on next send. + */ + b_sub(buf, lensz + (pos - old)); break; } @@ -404,7 +409,7 @@ int qcc_qmux_send_frames(struct qcc *qcc, struct list *frms) else if (!LIST_ISEMPTY(frms)) { if (!(qcc->wait_event.events & SUB_RETRY_SEND)) conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_SEND, &qcc->wait_event); - ret = 1; + ret = -1; } else { ret = 0;