]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: sink: pre-initialize the implicit log forwarding server
authorWilly Tarreau <w@1wt.eu>
Wed, 19 Aug 2026 15:24:14 +0000 (17:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Aug 2026 15:48:20 +0000 (17:48 +0200)
commit3081fdb5846b1b7ab8f93d1f28b31af13502f5db
tree13f0b351d532077a7e0d3acb59fe3db73dc97754
parent0bcd3f83af03b45ae203c36e8af26486a0f4154b
BUG/MEDIUM: sink: pre-initialize the implicit log forwarding server

Since commit 368d01361a ("MEDIUM: server: add and use srv_init() function")
a "log tcp@127.0.0.1:514" line in the global section causes a segfault at
boot, without even trying to connect anywhere.

In this case the target is a ring, which relies on a server to forward
its data. That server is created by sink_new_from_logger(), which is
reached from postresolve_loggers() in REGISTER_POST_CHECK, so it runs
after check_config_validity() has walked all_servers to call srv_preinit()
on every known servers, and after the REGISTER_POST_SERVER_CHECK hooks.
The server therefore never gets initialized, srv->per_thr and srv->per_tgrp
are left NULL, and the first forwarding session dies in stream_set_target()
on per_tgrp[tgid - 1].nb_strm.

sink_new_from_logger() used to call srv_init_per_thr() itself before
the change above, srv_init() has since been split, and the per-thread
part is now srv_preinit(), so let's just call that from there.

Note that the same ordering means these servers also miss srv_postinit(),
so their shared counters stay NULL. They are not used with sinks so we
probably don't care and would better not touch that now, but it's worth
keeping in mind.

This should be backported to 3.3.
src/sink.c