]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: log: Eat output data when waiting for appctx shutdown
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 05:56:50 +0000 (07:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 06:19:06 +0000 (08:19 +0200)
When the log 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.

It is 2.8-specific. No backport needed.

src/log.c

index 6ba601d42cdf9055f6c2776caa4f68158dd6be60..65b3ce1aff4af700750e2dfa8e88ce5ae3b3b8d1 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -3577,8 +3577,10 @@ static void syslog_io_handler(struct appctx *appctx)
        char *message;
        size_t size;
 
-       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;
+       }
 
        max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
        while (co_data(sc_oc(sc))) {