From 3197d778e0d16f7be5f8f887c352c00fe098068d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 18 Nov 2023 02:58:50 +0900 Subject: [PATCH] journal: sync immediately on shutting down journald Otherwise, sd_event_add_time_relative() or sd_event_source_set_time_relative() below will trigger assert_return(). Prompted by #30029. --- src/journal/journald-server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 85def6c..1c3a2a0 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1877,6 +1877,12 @@ int server_schedule_sync(Server *s, int priority) { return 0; } + if (!s->event || sd_event_get_state(s->event) == SD_EVENT_FINISHED) { + /* Shutting down the server? Let's sync immediately. */ + server_sync(s); + return 0; + } + if (s->sync_scheduled) return 0; -- 2.7.4