From f0f03b98f773cbf902bed59d0a3008c60fce8a06 Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Mon, 28 Oct 2024 15:17:11 +0100 Subject: [PATCH] BUG/MINOR: errors: print_message: don't allocate startup logs ring Don't call startup_logs_init() in order to allocate the startup logs ring again, if startup_logs pointer is NULL. Startup logs ring is allocated explicitly in step_init_1 routine, when the process starts, and it's freed explicitly for master process at the end of mworker_reexec scope. So, when we no longer have this pointer, let's just save the log message in the message buffer. Otherwise, in case of master process, we will allocate the startup logs ring again here and we will lost its address after execvp. No need to backport this fix as it's related to the latest master-worker refactoring. --- src/errors.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/errors.c b/src/errors.c index 201eece57b..8c508e7af2 100644 --- a/src/errors.c +++ b/src/errors.c @@ -340,9 +340,6 @@ static void print_message(int use_usermsgs_ctx, const char *label, const char *f } if (global.mode & MODE_STARTING) { - if (unlikely(!startup_logs)) - startup_logs_init(); - if (likely(startup_logs)) { struct ist m[3]; @@ -351,7 +348,8 @@ static void print_message(int use_usermsgs_ctx, const char *label, const char *f m[2] = msg_ist; ring_write(startup_logs, ~0, 0, 0, m, 3); - } + } else + usermsgs_put(&msg_ist); } else { usermsgs_put(&msg_ist);