]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua: Reset analyse expiration timeout before executing a lua action
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 2 Jun 2020 16:46:07 +0000 (18:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Jun 2020 08:24:58 +0000 (10:24 +0200)
Before executing a lua action, the analyse expiration timeout of the
corresponding channel must be reset. Otherwise, when it expires, for instance
because of a call to core.msleep(), if the action yields, an expired timeout
will be used for the stream's task, leading to a loop.

This patch should fix the issue #661. It must be backported in all versions
supporting the lua.

src/hlua.c

index f0d7e0f9e6649fbad6ceef08b3ac4f9fb008fd46..f2b6620448b3a43f2d685940790cc02628c61c60 100644 (file)
@@ -6618,6 +6618,15 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
                s->hlua->max_time = hlua_timeout_session;
        }
 
+       /* Always reset the analyse expiration timeout for the corresponding
+        * channel in case the lua script yield, to be sure to not keep an
+        * expired timeout.
+        */
+       if (dir == SMP_OPT_DIR_REQ)
+               s->req.analyse_exp = TICK_ETERNITY;
+       else
+               s->res.analyse_exp = TICK_ETERNITY;
+
        /* Execute the function. */
        switch (hlua_ctx_resume(s->hlua, !(flags & ACT_OPT_FINAL))) {
        /* finished. */