Hi,
While developing the cloudauth addon
(https://github.com/git001/haproxy-cloudauth), I ran into a small
endless loop in the dump of the metrics of the promex modules.
When the fill_ts() callback of a module returns 0 to skip a time
series, the exporter never moves to the next one, so the scrape loops
until the watchdog kills the process.
It does not happen with HAProxy itself, since none of its modules
returns 0 there with a valid configuration, but other modules could
stumble over it. The fix is a one-liner, see the attached patch.
Regards,
Aleks
From 1c59448a5360d93921c90ed4795a2fd1e6995882 Mon Sep 17 00:00:00 2001
From: Aleksandar Lazic <[email protected]>
Date: Tue, 20 Oct 2026 20:42:11 +0200
Subject: [PATCH] BUG/MINOR: promex: don't loop forever when a module skips a
time series
The fill_ts() callback of a promex module may return 0 to skip the
current time series. In this case, promex_dump_module_metrics() jumps
back to the beginning of the loop on the time series with "continue",
without calling next_ts(). So fill_ts() is called again for the same
time series, forever, until the watchdog kills the process. The "next"
label, which retrieves the next time series, was obviously meant to be
used there, but it is never reached by a jump.
The modules of HAProxy itself never skip a time series with a valid
configuration (the stick-table module only skips the tables with a
null size), but an external module doing so triggers the issue at the
first scrape of its metrics.
The issue was introduced by commit 5f875414e ("MEDIUM: promex: Dump
metrics of registered modules with a way to filter them"). This patch
must be backported as far as 3.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Aleksandar Lazic <[email protected]>
---
addons/promex/service-prometheus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c
index 4de3ec8e3..fd9a81467 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -1586,7 +1586,7 @@ static int promex_dump_module_metrics(struct appctx *appctx, struct promex_modul
ret = mod->fill_ts(ctx->p[1], ctx->p[2], ctx->mod_field_num, labels, &val);
if (!ret)
- continue;
+ goto next;
if (ret < 0)
goto error;
--
2.56.0