As described in GH #3527, a weird behavior affects backend shared counters
where haproxy would restore stats inconsistently. In fact, the described
behavior happens because the stats file preloading mechanism is broken
for backend objects since
5495c88 ("MEDIUM: counters: Dynamically allocate
per-thread group counters") because we checked for the frontend shared map
(allocated once per process) instead of the backend one for backend
objects, and the frontend map is only allocated for frontends or hybrid
proxies, and not backends. This caused the preloading to abort.
We fix by checking the relevant backend oriented map instead. It should be
backported to 3.4.
Thanks to GH user @ssavant2 for his detailed report and patch feedback.
} else if (curr_obj->type == SHM_STATS_FILE_OBJECT_TYPE_BE) {
if (!px->be_counters.shared.tg)
px->be_counters.shared.tg = calloc(global.nbtgroups, sizeof(*px->be_counters.shared.tg));
- if (px->fe_counters.shared.tg == NULL)
+ if (px->be_counters.shared.tg == NULL)
goto release;
px->be_counters.shared.tg[obj_tgid - 1] = &curr_obj->data.be;
} else