]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: applet: do not put SE_FL_WANT_ROOM on rcv_buf() if the channel is empty
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Oct 2025 14:41:05 +0000 (15:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Oct 2025 15:57:07 +0000 (16:57 +0100)
commit35106d65fb4df0aee692d4aae07f5d388c53983c
tree75fa52140de5702b04d2e4ae9ea9cf1f65b9b9c8
parent259b1e1c18b2daeede208fb86a43746ff18f2391
MINOR: applet: do not put SE_FL_WANT_ROOM on rcv_buf() if the channel is empty

appctx_rcv_buf() prepares all the work to schedule the transfers between
the applet and the channel, and it takes care of setting the various flags
that indicate what condition is blocking the transfer from progressing.

There is one limitation though. In case an applet refrains from sending
data (e.g. rate-limited, prefers to aggregate blocks etc), it will leave
a possibly empty channel buffer, and keep some data in its outbuf. The
data in its outbuf will be seen by the function above as an indication
of a channel full condition, so it will place SE_FL_WANT_ROOM. But later,
sc_applet_recv() will see this flag with a possibly empty channel, and
will rightfully trigger a BUG_ON().

appctx_rcv_buf() should be more accurate in fact. It should only set
SE_FL_RCV_MORE when more data are present in the applet, then it should
either set or clear SE_FL_WANT_ROOM dependingon whether the channel is
empty or not.

Right now it doesn't seem possible to trigger this condition in the
current state of applets, but this will become possible with a future
bugfix that will have to be backported, so this patch will need to be
backported to 3.0.
src/applet.c