From 9b07d4fecd9451ad1e373c6c52c0547885c29920 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Fri, 3 Feb 2023 11:43:05 +0100 Subject: [PATCH] BUG/MINOR: stats: fix ctx->field update in stats_dump_proxy_to_buffer() When ctx->field was introduced with ("MINOR: stats: introduce stats field ctx") a mistake was made for the STAT_PX_ST_LI state in stats_dump_proxy_to_buffer(): current_field reset is placed after the for loop, ie: after multiple lines are dumped. Instead it should be placed right after each li line is dumped. This could cause some output inconsistencies (missing fields), especially when http dump is used with JSON output and "socket-stats" option is enabled on the proxy, because when htx is full we restore the ctx->field with current_field (which contains outdated value in this case). This should be backported with ("MINOR: stats: introduce stats field ctx") --- src/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stats.c b/src/stats.c index eea5d7c92..5be66d484 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3249,9 +3249,9 @@ more: if (ctx->field) goto more; } + current_field = 0; } - current_field = 0; ctx->obj2 = px->srv; /* may be NULL */ ctx->px_st = STAT_PX_ST_SV; __fallthrough;