From ecc54e2a2019fcd3199286e144ced956e5c7cefe Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 26 Aug 2026 15:26:35 +0200 Subject: [PATCH] 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. --- src/sink.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.47.3