From 972ce87676f40daa76fff61539fb5b0a66b56f4b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 17 Feb 2025 14:49:34 +0100 Subject: [PATCH] BUG/MEDIUM: cli: Be sure to drop all input data in END state Commit 7214dcd ("BUG/MEDIUM: applet: Don't pretend to have more data to handle EOI/EOS/ERROR") revealed a bug with the CLI applet. Pending input data when the applet is in CLI_ST_END state were never consumed or dropped, leading to a wakeup loop. The CLI applet implements its own snd_buf callback function. It is important it consumes all pending input data. Otherwise, the applet is woken up in loop until it empties the request buffer. Another way to fix the issue would be to report an error. But in that case, it seems reasonnable to drop these data. The issue can be observed on reload, in master/worker mode, because of issue about the last ACK message which was never consummed by the _getsocks() command. This patch should fix the issue #2862. It must be backported to 3.1 with the commit above. --- src/cli.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli.c b/src/cli.c index d22a62ea5..1b6c0cbc6 100644 --- a/src/cli.c +++ b/src/cli.c @@ -924,6 +924,12 @@ size_t cli_snd_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsi if (appctx->st0 == CLI_ST_INIT) cli_init(appctx); + else if (appctx->st0 == CLI_ST_END) { + /* drop all data on END state */ + ret = count; + b_del(buf, ret); + goto end; + } else if (appctx->st0 != CLI_ST_GETREQ) goto end;