BUG/MEDIUM: cli: Be sure to drop all input data in END state
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Feb 2025 13:49:34 +0000 (14:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Feb 2025 09:35:04 +0000 (10:35 +0100)
commit05c1745459966d128ab9798f3721b889a2a135fd
tree905ac669449a12e8f5429df92047984a0234f04c
parent7b8ec84c40f08eb25840929f014dc47cde3c099e
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.

(cherry picked from commit 972ce87676f40daa76fff61539fb5b0a66b56f4b)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/cli.c