From: Olivier Houchard Date: Fri, 20 Nov 2026 14:33:44 +0000 (+0100) Subject: BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue X-Git-Url: https://git.kaiwu.me/http/ngx_http_access_module.html?a=commitdiff_plain;h=edaac42ff119b30163ccf651d5241655832af53a;p=haproxy.git BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue spop_buf_available() is called by offer_buffers() while the spop_conn is still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf: refrain from offering a buffer if more critical ones are waiting"), b_alloc() refuses to allocate when the queue of the same or of a more critical level is not empty, unless DB_F_NOQUEUE is passed. As the spop_conn is queued with DB_MUX_RX, the demux buffer allocation always fails from the callback, and the connection remains blocked until it times out. This was reproduced by faking a failed demux buffer allocation when receiving the agent's reply: the SPOE processing times out. Let's pass DB_F_NOQUEUE to the allocations made from the callback, as was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the buffer callback to allocate despite the queue"). The issue comes from the commit above, and mux-spop is affected since it was introduced in 3.1. This must be backported to 3.1. --- diff --git a/src/mux_spop.c b/src/mux_spop.c index daf5ace27..d00849a9f 100644 --- a/src/mux_spop.c +++ b/src/mux_spop.c @@ -467,14 +467,15 @@ static int spop_buf_available(void *target) struct spop_conn *spop_conn = target; struct spop_strm *spop_strm; - if ((spop_conn->flags & SPOP_CF_DEM_DALLOC) && b_alloc(&spop_conn->dbuf, DB_MUX_RX)) { + /* we're still in the queue here, hence DB_F_NOQUEUE */ + if ((spop_conn->flags & SPOP_CF_DEM_DALLOC) && b_alloc(&spop_conn->dbuf, DB_MUX_RX | DB_F_NOQUEUE)) { TRACE_STATE("unblocking spop_conn, dbuf allocated", SPOP_EV_SPOP_CONN_RECV|SPOP_EV_SPOP_CONN_BLK|SPOP_EV_SPOP_CONN_WAKE, spop_conn->conn); spop_conn->flags &= ~SPOP_CF_DEM_DALLOC; spop_conn_restart_reading(spop_conn, 1); return 1; } - if ((spop_conn->flags & SPOP_CF_MUX_MALLOC) && b_alloc(br_tail(spop_conn->mbuf), DB_MUX_TX)) { + if ((spop_conn->flags & SPOP_CF_MUX_MALLOC) && b_alloc(br_tail(spop_conn->mbuf), DB_MUX_TX | DB_F_NOQUEUE)) { TRACE_STATE("unblocking spop_conn, mbuf allocated", SPOP_EV_SPOP_CONN_SEND|SPOP_EV_SPOP_CONN_BLK|SPOP_EV_SPOP_CONN_WAKE, spop_conn->conn); spop_conn->flags &= ~SPOP_CF_MUX_MALLOC; if (spop_conn->flags & SPOP_CF_DEM_MROOM) { @@ -486,7 +487,7 @@ static int spop_buf_available(void *target) if ((spop_conn->flags & SPOP_CF_DEM_SALLOC) && (spop_strm = spop_conn_st_by_id(spop_conn, spop_conn->dsi)) && spop_strm_sc(spop_strm) && - b_alloc(&spop_strm->rxbuf, DB_SE_RX)) { + b_alloc(&spop_strm->rxbuf, DB_SE_RX | DB_F_NOQUEUE)) { TRACE_STATE("unblocking spop_strm, rxbuf allocated", SPOP_EV_STRM_RECV|SPOP_EV_SPOP_STRM_BLK|SPOP_EV_STRM_WAKE, spop_conn->conn, spop_strm); spop_conn->flags &= ~SPOP_CF_DEM_SALLOC; spop_conn_restart_reading(spop_conn, 1);