Hi again,
Le 26/05/2016 11:45, Cyril Bonté a écrit :
Hi Olivier,
De: "Olivier Doucet" <webmas...@ajeux.com>
À: "HAProxy" <haproxy@formilux.org>
Envoyé: Jeudi 26 Mai 2016 11:25:31
Objet: "show servers state" wrong since HAProxy 1.6.5
Hello,
Starting with HAProxy 1.6.5, I have troubles with "show servers
state" that returns me wrong data (backend servers are mixed up).
I have nbproc > 1 and I bind one socket to each core.
I narrowed it to a very simple config file to reproduce the issue :
https://gist.github.com/odoucet/f59a23c29c8fb21fe58d2ec9dd53a685
As you can see, backends are mixed up when interrogating socket #3.
I tested the exact same config with version 1.6.3 and output is OK,
so this is definitely a bug introduced in latest version.
Thanks for the report.
Unfortunately, it's possible I introduced a regression with this commit :
http://www.haproxy.org/git?p=haproxy.git;a=commit;h=76a99784f4ced2529e35469ccaa8e803ca397e86
Without looking at the code, I think I know where.
I'll work on this tonight, after work.
As I thought after looking at the code, there was an initialization code
left before the "bind_proc" check.
Can you try this small patch to confirm it will work with all the
configurations you may think of ?
I'm not fond of the code structure, so it's possible I won't provide the
patch as is for the merge request.
--
Cyril Bonté
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 19e2688..1a3c42a 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3076,6 +3076,9 @@ static int dump_servers_state(struct stream_interface *si, struct chunk *buf)
if (appctx->ctx.server_state.px->bind_proc && !(appctx->ctx.server_state.px->bind_proc & (1UL << (relative_pid - 1))))
return 1;
+ if (!appctx->ctx.server_state.sv)
+ appctx->ctx.server_state.sv = appctx->ctx.server_state.px->srv;
+
for (; appctx->ctx.server_state.sv != NULL; appctx->ctx.server_state.sv = srv->next) {
srv = appctx->ctx.server_state.sv;
srv_addr[0] = '\0';
@@ -3178,8 +3181,6 @@ static int stats_dump_servers_state_to_buffer(struct stream_interface *si)
for (; appctx->ctx.server_state.px != NULL; appctx->ctx.server_state.px = curproxy->next) {
curproxy = appctx->ctx.server_state.px;
- if (!appctx->ctx.server_state.sv)
- appctx->ctx.server_state.sv = appctx->ctx.server_state.px->srv;
/* servers are only in backends */
if (curproxy->cap & PR_CAP_BE) {
if (!dump_servers_state(si, &trash))