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.
}
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);
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;