]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: server: adjust initialization order for dynamic servers
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Feb 2026 19:28:50 +0000 (20:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Feb 2026 07:24:03 +0000 (08:24 +0100)
commit709c3be845d81db730c0a61268f1c1576c9e141f
tree8ad2edd0d2c7e06ed49fb214854c717ee0292217
parent44932b6c417e472d25039ec3d7b8bf14e07629bc
BUG/MINOR: server: adjust initialization order for dynamic servers

It appears that in cli_parse_add_server(), we're calling srv_alloc_lb()
and stats_allocate_proxy_counters_internal() before srv_preinit() which
allocates the thread groups. LB algos can make use of the per_tgrp part
which is initialized by srv_preinit(). Fortunately for now no algo uses
both tgrp and ->server_init() so this explains why this remained
unnoticed to date. Also, extra counters will soon require per_tgrp to
already be initialized. So let's move these between srv_preinit() and
srv_postinit(). It's possible that other parts will have to be moved
in between.

This could be backported to recent versions for the sake of safety but
it looks like the current code cannot tell the difference.
src/server.c