From: Willy Tarreau Date: Tue, 23 Jun 2015 13:17:33 +0000 (+0200) Subject: BUG/MEDIUM: vars: do not freeze the connection when the expression cannot be fetched X-Git-Tag: v1.6-dev3~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44136fe69a1b4fa7346114fa4923f3a0de59aee;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/vars.c b/src/vars.c index fa521f35e1..74a6ec8ffb 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);