]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: promex: fix server iteration when last server is deleted
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 26 Feb 2026 10:18:43 +0000 (11:18 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 26 Feb 2026 17:24:36 +0000 (18:24 +0100)
commit5000f0b2ef86f01b74c5392fd5e4db32d0a60828
tree391dce9a806598fb4f1caaaa8e579556b7ee3ee5
parent00a106059eecf9a01b4d455314bdb59e792f1082
BUG/MINOR: promex: fix server iteration when last server is deleted

Servers iteration via promex is now resilient to server runtime deletion
thanks to the watcher mechanism. However, the watcher was not correctly
initialized which could cause duplicate metrics reporting.

This issue happens when promex dump yielded when manipulating the last
server of a proxy. If this server is removed in parallel, <sv> pointer
will be set to NULL when promex resumes. Instead of switching to another
proxy, the code would reuse the same one and iterate again on the same
server list.

To fix this issue, <sv> pointer must not be reinitialized just after a
resumption point. Instead, this is now performed before
promex_dump_srv_metrics(), or just after switching to another proxy
instance. Thus, on resumption, if promex_dump_srv_metrics() is started
with <sv> as NULL, it means that the server was deleted and the end of
the current proxy list is reached, hence iteration is restarted on the
next proxy instance.

Note that ctx.p[1] does not need to be manually updated at the end of
promex_dump_srv_metrics() as srv_watch already does that.

This patch must be backported up to 3.0.
addons/promex/service-prometheus.c