]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: stconn/applet: Block 0-copy forwarding if producer needs more room
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Feb 2024 21:17:59 +0000 (22:17 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 Feb 2024 13:22:36 +0000 (14:22 +0100)
commit5df45cff8fb0468d8d6a54bc1a7579443af2717e
tree662bfaa7ab093b9a95190c3ee42a373447e5e1be
parentece002af1db63e5e0e5d48e903c7d75ef618bd49
BUG/MEDIUM: stconn/applet: Block 0-copy forwarding if producer needs more room

This case does not exist yet with the H1 multiplexer, but applets may decide to
not produce data if there is not enough room in the destination buffer (the
applet's outbuf or the opposite SE buffer). It is true for the stats applets for
instance. However this case is not properly handled when the zero-copy
forwarding is in-use.

To fix the issue, the se_done_ff() function was modified to return the number of
bytes really forwarded and to subs for sends if nothing was forwarded while the
zero-copy forwarding was blocked by the producer. On the applet side, we take
care to block the zero-copy forwarding if the applet requests more room. At the
end, zero-copy forwarding is unblocked if something was forwarded.

This way, it is now possible for the stats applet to report a full buffer and
block the zero-copy forwarding, even if the buffer is not really full, by
requesting more room.

No backport needed.
include/haproxy/stconn.h
src/applet.c
src/stats.c