From e44136fe69a1b4fa7346114fa4923f3a0de59aee Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 23 Jun 2015 15:17:33 +0200 Subject: [PATCH] BUG/MEDIUM: vars: do not freeze the connection when the expression cannot be fetched Commit 4834bc7 ("MEDIUM: vars: adds support of variables") brought a bug. Setting a variable from an expression that doesn't resolve infinitely blocks the processing. The internal actions API must be changed to let the caller pass the various flags regarding the state of the analysis (SMP_OPT_FINAL). For now we only fix the issue by making the action_store() function always return 1 to prevent any blocking. No backport is needed. --- src/vars.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vars.c b/src/vars.c index fa521f35e..74a6ec8ff 100644 --- a/src/vars.c +++ b/src/vars.c @@ -449,7 +449,9 @@ int vars_get_by_name(const char *name, size_t len, struct stream *strm, struct s return 1; } -/* Returns 0 if miss data, else returns 1. */ +/* Returns 0 if we need to come back later to complete the sample's retrieval, + * otherwise 1. For now all processing is considered final so we only return 1. + */ static inline int action_store(struct sample_expr *expr, const char *name, enum vars_scope scope, struct proxy *px, struct stream *s, int sens) @@ -459,7 +461,7 @@ static inline int action_store(struct sample_expr *expr, const char *name, /* Process the expression. */ memset(&smp, 0, sizeof(smp)); if (!sample_process(px, s->sess, s, sens|SMP_OPT_FINAL, expr, &smp)) - return 0; + return 1; /* Store the sample, and ignore errors. */ sample_store_stream(name, scope, s, &smp);