BUG/MINOR: lua: Abort execution of actions that yield on a final evaluation
A Lua action may yield. It may happen because the action returns explicitly
act.YIELD or because the script itself yield. In the first case, we must abort
the script execution if it is the final rule evaluation, i.e if the
ACT_OPT_FINAL flag is set. The second case is already covered.
This patch must be backported to 2.2.
diff --git a/src/hlua.c b/src/hlua.c
index 1227db4..63ca26b 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -6649,11 +6649,16 @@
act_ret = lua_tointeger(s->hlua->T, -1);
/* Set timeout in the required channel. */
- if (act_ret == ACT_RET_YIELD && s->hlua->wake_time != TICK_ETERNITY) {
- if (dir == SMP_OPT_DIR_REQ)
- s->req.analyse_exp = s->hlua->wake_time;
- else
- s->res.analyse_exp = s->hlua->wake_time;
+ if (act_ret == ACT_RET_YIELD) {
+ if (flags & ACT_OPT_FINAL)
+ goto err_yield;
+
+ if (s->hlua->wake_time != TICK_ETERNITY) {
+ if (dir == SMP_OPT_DIR_REQ)
+ s->req.analyse_exp = s->hlua->wake_time;
+ else
+ s->res.analyse_exp = s->hlua->wake_time;
+ }
}
goto end;
@@ -6694,6 +6699,8 @@
goto end;
case HLUA_E_YIELD:
+ err_yield:
+ act_ret = ACT_RET_CONT;
SEND_ERR(px, "Lua function '%s': aborting Lua processing on expired timeout.\n",
rule->arg.hlua_rule->fcn.name);
goto end;