]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli: Eat output data when waiting for appctx shutdown
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Apr 2023 16:07:51 +0000 (18:07 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 05:43:26 +0000 (07:43 +0200)
When the cli applet is executed while a shut is pending, the remaining
output data must always be consumed. Otherwise, this can prevent the stream
to exit, leading to a spinning loop on the applet.

This patch should fix the issue #2107. It is 2.8-specific. No backport
needed.

src/cli.c

index 0849cbe9a9d192c1a63945f887314d1840d62c38..820a45adcf8ad88891b1cc0c93fcf7b6923838d2 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -893,8 +893,10 @@ static void cli_io_handler(struct appctx *appctx)
        int reql;
        int len;
 
-       if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW))))
+       if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR|SE_FL_SHR|SE_FL_SHW)))) {
+               co_skip(sc_oc(sc), co_data(sc_oc(sc)));
                goto out;
+       }
 
        /* Check if the input buffer is available. */
        if (!b_size(&res->buf)) {