]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: hlua: emit a log instead of an alert for aborted actions due to unavailable...
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 23 Jun 2025 14:23:33 +0000 (16:23 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 24 Jun 2025 08:55:55 +0000 (10:55 +0200)
commitc0f602485425bbf2f8c03d93be7dc49395c66186
tree2492f29ff69aa61d5b25774283643fde8634584f
parent20a82027ceb7a46ce2a0cbe05e40c63d132601f7
MINOR: hlua: emit a log instead of an alert for aborted actions due to unavailable yield

As reported by Chris Staite in GH #3002, trying to yield from a Lua
action during a client disconnect causes the script to be interrupted
(which is expected) and an alert to be emitted with the error:
"Lua function '%s': yield not allowed".

While this error is well suited for cases where the yield is not expected
at all (ie: when context doesn't allow it) and results from a yield misuse
in the Lua script, it isn't the case when the yield is exceptionnally not
available due to an abort or error in the request/response processing.
Because of that we raise an alert but the user cannot do anything about it
(the script is correct), so it is confusing and polluting the logs.

In this patch we introduce the ACT_OPT_FINAL_EARLY flag which is a
complementary flag to ACT_OPT_FIRST. This flag is set when the
ACT_OPT_FIRST is set earlier than normal (due to error/abort).
hlua_action() then checks for this flag to decide whether an error (alert)
or a simple log message should be emitted when the yield is not available.

It should solve GH #3002. Thanks to Chris Staite (@chrisstaite-menlo) for
having reported the issue and suggested a solution.
include/haproxy/action-t.h
src/hlua.c
src/http_ana.c
src/tcp_rules.c