From 9c80bb9fb088dd897f230b2d4a1c9f284ea6b111 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 7 May 2026 14:42:29 +0200 Subject: [PATCH] - Fix to clean up log ids after a failure to start a worker thread. --- daemon/daemon.c | 12 +++++++++--- doc/Changelog | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/daemon/daemon.c b/daemon/daemon.c index ea4e83e70..9a692c1cb 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -940,8 +940,10 @@ thread_start(void* arg) port_num = 0; #endif if(!worker_init(worker, worker->daemon->cfg, - worker->daemon->ports[port_num], 0)) + worker->daemon->ports[port_num], 0)) { + log_thread_set(NULL); fatal_exit("Could not initialize thread"); + } worker_work(worker); return NULL; @@ -1103,8 +1105,10 @@ daemon_fork(struct daemon* daemon) #if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) /* in libev the first inited base gets signals */ - if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) + if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) { + log_thread_set(NULL); fatal_exit("Could not initialize main thread"); + } #endif /* Now create the threads and init the workers. @@ -1117,8 +1121,10 @@ daemon_fork(struct daemon* daemon) */ #if !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) /* libevent has the last inited base get signals (or any base) */ - if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) + if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports[0], 1)) { + log_thread_set(NULL); fatal_exit("Could not initialize main thread"); + } #endif signal_handling_playback(daemon->workers[0]); diff --git a/doc/Changelog b/doc/Changelog index 059a5f19f..19841b004 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -4,6 +4,7 @@ large values for num_ports do not overflow and create invalid references after integer truncation. Thanks to Karnakar Reddy (@karnakarreddi) for the report. + - Fix to clean up log ids after a failure to start a worker thread. 1 May 2026: Wouter - iana portlist updated.