BUG/MINOR: resolvers: Wait the resolution execution for a do_resolv action

The do_resolv action triggers a resolution and must wait for the
result. Concretely, if no cache entry is available, it creates a resolution
and wakes up the resolvers task. Then it yields. When the action is
recalled, if the resolution is still running, it yields again.

However, if the resolution is not running, it does not check it was
running. Thus, it is possible to ignore the resolution because the action
was recalled before the resolvers task had a chance to be executed. If there
is result, the action must yield.

This patch should fix the issue #1993. It must be backported as far as 2.0.

(cherry picked from commit 51dbb4cb798ca52167041790783030bcebda98b1)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 4283282a61370c3ae406aa7a9e300c0ed1116f4c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
Christopher Faulet 2023-01-11 10:31:10 +01:00
parent c79c7f4912
commit ba582b85a5

View File

@ -2930,7 +2930,12 @@ enum act_return resolv_action_do_resolve(struct act_rule *rule, struct proxy *px
if (resolution->step == RSLV_STEP_RUNNING)
goto yield;
if (resolution->step == RSLV_STEP_NONE) {
/* We update the variable only if we have a valid response. */
/* We update the variable only if we have a valid
* response. If the response was not received yet, we
* must yield.
*/
if (resolution->status == RSLV_STATUS_NONE)
goto yield;
if (resolution->status == RSLV_STATUS_VALID) {
struct sample smp;
short ip_sin_family = 0;