From 1b4255a885d332a53f73f0849108a7ec2bf6d19c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 3 Jun 2026 11:27:30 +0200 Subject: [PATCH] BUG/MEDIUM: channel: Fix condition to know if a channel may send Historically, we considered a channel cannot send before the connection was established. This was useful to know if the reserve should still be respected for the receives. This was because it was possible to rewrite the request on connection retry (because of http-send-name-header option). However noadays, it is a useless limitation. Once data forwarding is started, there is no longer rewrites on the request at the stream layer (http-send-name-header option is handled by the muxes). And, since it is possible to use small buffers to queue requests, it could be an issue, because the reserve and the small buffer size are the same by default. Once a small request was finally dequeued, the receives on client side were not re-armed because we should still respect the reserve on receives (channel_recv_limit() was returning 0 in that case). To fix the issue, we must consider a channel may send since the underlying stconn has reached the SC_ST_REQ state, instead of SC_ST_EST. Doing so, we are able to ignore the reserve earlier and the receives can be re-armed even with small buffers. There is no reason to backport this patch, except if an issue is reported, because only the 3.4 is concerned. But it could theorically be backported to all stable versions. --- include/haproxy/channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index b76783e5a..ebe316d8d 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -422,7 +422,7 @@ static inline int channel_is_rewritable(const struct channel *chn) */ static inline int channel_may_send(const struct channel *chn) { - return chn_cons(chn)->state == SC_ST_EST; + return chn_cons(chn)->state >= SC_ST_REQ; } /* HTX version of channel_may_recv(). Returns non-zero if the channel can still