From: Christopher Faulet Date: Wed, 1 Jun 2022 15:25:42 +0000 (+0200) Subject: BUG/MEDIUM: cli: Notify cli applet won't consume data during request processing X-Git-Tag: v2.7-dev1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4167e050022dbd2564fa43ae39159cf3588c60ff;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: cli: Notify cli applet won't consume data during request processing The CLI applet process one request after another. Thus, when several requests are pipelined, it is important to notify it won't consume remaining outgoing data while it is processing a request. Otherwise, the applet may be woken up in loop. For instance, it may happen with the HTTP client while we are waiting for the server response if a shutr is received. This patch must be backported in all supported versions after an observation period. But a massive refactoring was performed in 2.6. So, for the 2.5 and below, the patch will have to be adapted. Note also that, AFAIK, the bug can only be triggered by the HTTP client for now. --- diff --git a/src/cli.c b/src/cli.c index 5cb34cbf43..bd77418fe5 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1136,8 +1136,10 @@ static void cli_io_handler(struct appctx *appctx) } /* If the output functions are still there, it means they require more room. */ - if (appctx->st0 >= CLI_ST_OUTPUT) + if (appctx->st0 >= CLI_ST_OUTPUT) { + applet_wont_consume(appctx); break; + } /* Now we close the output if one of the writers did so, * or if we're not in interactive mode and the request @@ -1152,6 +1154,8 @@ static void cli_io_handler(struct appctx *appctx) /* switch state back to GETREQ to read next requests */ appctx->st0 = CLI_ST_GETREQ; + applet_will_consume(appctx); + /* reactivate the \n at the end of the response for the next command */ appctx->st1 &= ~APPCTX_CLI_ST1_NOLF;