From: Christopher Faulet Date: Tue, 29 Sep 2026 07:28:45 +0000 (+0200) Subject: BUG/MINOR: resolvers: don't dump a nameserver twice in "show resolvers" X-Git-Url: https://git.kaiwu.me/$%7BGITURL%7D$%7Bcid%7D?a=commitdiff_plain;h=472a0ca440b6bb200b3ea3a23ba6ee10dbe8fa5f;p=haproxy.git BUG/MINOR: resolvers: don't dump a nameserver twice in "show resolvers" When the output buffer is full, "show resolvers" yields and resumes from the nameserver saved in its context. But this one is only updated after a nameserver was successfully dumped, so the dump resumes from the last nameserver already dumped, which appears twice in the output, instead of the one which could not be dumped. This can be reproduced with 40 nameservers in a section and "tune.bufsize 4096": "show resolvers" lists 43 nameservers, ns13, ns25 and ns37 appearing twice. Let's save the nameserver being dumped before trying to dump it instead. This patch should be backported to all stable branches. --- diff --git a/src/resolvers.c b/src/resolvers.c index addc98836..a3091b95d 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -3208,6 +3208,8 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) } list_for_each_entry_from(ns, &resolvers->nameservers, list) { + /* restart from this one if the buffer is full */ + ctx->ns = ns; chunk_reset(&trash); chunk_appendf(&trash, " nameserver %s:\n", ns->id); chunk_appendf(&trash, " sent: %lld\n", ns->counters->sent); @@ -3228,7 +3230,6 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) chunk_appendf(&trash, " outdated: %lld\n", ns->counters->app.resolver.outdated); if (applet_putchk(appctx, &trash) == -1) goto full; - ctx->ns = ns; } ctx->ns = NULL;