]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: hlua: Make sure we drain the output buffer when done.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 Aug 2018 12:41:31 +0000 (14:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Aug 2018 14:18:34 +0000 (16:18 +0200)
In hlua_applet_tcp_fct(), drain the output buffer when the applet is done
running, every time we're called.
Overwise, there's a race condition, and the output buffer could be filled
after the applet ran, and as it is never cleared, the stream interface
will never be destroyed.

This should be backported to 1.8 and 1.7.

src/hlua.c

index edb4f68cac7ea33ff6e9632ecce1e98990b359ff..7bbc854d0c11bbb2d40b607bf3bc2c46e544c61c 100644 (file)
@@ -6446,8 +6446,11 @@ static void hlua_applet_tcp_fct(struct appctx *ctx)
        struct hlua *hlua = ctx->ctx.hlua_apptcp.hlua;
 
        /* The applet execution is already done. */
-       if (ctx->ctx.hlua_apptcp.flags & APPLET_DONE)
+       if (ctx->ctx.hlua_apptcp.flags & APPLET_DONE) {
+               /* eat the whole request */
+               co_skip(si_oc(si), co_data(si_oc(si)));
                return;
+       }
 
        /* If the stream is disconnect or closed, ldo nothing. */
        if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))