]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli: State the cli have no more data to deliver if it yields
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 21 Nov 2025 08:47:01 +0000 (09:47 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 21 Nov 2025 09:00:15 +0000 (10:00 +0100)
A regression was introduced in the commit 2d7e3ddd4 ("BUG/MEDIUM: cli: do
not return ACKs one char at a time"). When the CLI is processing a command
line, we no longer send response immediately. It is especially useful for
clients sending a bunch of commands with very short response.

However, in that state, the CLI applet must state it has no more data to
deliver. Otherwise it will be woken up again and again because data are
found in its output buffer with no blocking conditions. In worst cases, if
the command rate is really high, this can trigger the watchdog.

This patch must be backported where the patch above is, so probably as far
as 3.0.

src/cli.c

index fbf8f1d9d064e41e63d681425a6cb2253c2625e2..cbcecff43e963ba5c98935f8b82582d190e3a530 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -3910,8 +3910,10 @@ error:
 size_t cli_raw_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags)
 {
        /* don't send partial responses, we're just yielding to avoid CPU spikes */
-       if (appctx->st1 & APPCTX_CLI_ST1_YIELD)
+       if (appctx->st1 & APPCTX_CLI_ST1_YIELD) {
+               applet_have_no_more_data(appctx);
                return 0;
+       }
 
        return b_xfer(buf, &appctx->outbuf, MIN(count, b_data(&appctx->outbuf)));
 }