From: Willy Tarreau Date: Wed, 26 Aug 2026 13:26:35 +0000 (+0200) Subject: BUG/MEDIUM: sink: initialize the settings of the implicit log server X-Git-Tag: v3.5-dev6~67 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=ecc54e2a2019fcd3199286e144ced956e5c7cefe;p=haproxy.git BUG/MEDIUM: sink: initialize the settings of the implicit log server TCP logs currently work fairly badly due to connections closing immediately after logs are sent (or at best a full buffer of logs). This started to happen in 3.1 with commit 237849c911 ("MEDIUM: sink: "max-reuse" support for sink servers") thow that commit is not faulty, the issue stems to the complex server creation chain. What happens is that max_reuse >= 0 means the max-reuse setting is enable, and the sink server creation in sink_new_from_logger() creates a server but doesn't initialize it. Other servers are not exactly initialized, they're preset from defaults which are initialized. But here we don't inherit defaults so we must call srv_settings_init(), otherwise max_reuse remains zero and connections are closed after each message. This must be backported to 3.2. --- diff --git a/src/sink.c b/src/sink.c index cd12cb847..2f98424f4 100644 --- a/src/sink.c +++ b/src/sink.c @@ -1275,6 +1275,9 @@ struct sink *sink_new_from_logger(struct logger *logger) if (!srv) goto error; + /* there will be no defaults, we must initialize settings */ + srv_settings_init(srv); + /* init server */ srv->id = strdup(logger->target.ring_name); srv->conf.file = strdup(logger->conf.file);