From 64fcb61d5e0069fb3db625ac5441b8d7d8aac5c7 Mon Sep 17 00:00:00 2001 From: Firstyear Date: Tue, 3 Dec 2024 13:09:05 +1000 Subject: [PATCH] Work around systemd race condition (#3262) Systemd reload can't handle us reloading so quickly which causes "reload or restart" to always "restart" kanidm incorrectly. --- server/daemon/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/daemon/src/main.rs b/server/daemon/src/main.rs index a6a38b29f..bc7383307 100644 --- a/server/daemon/src/main.rs +++ b/server/daemon/src/main.rs @@ -787,8 +787,14 @@ async fn kanidm_main( sctx.tls_acceptor_reload().await; + // Systemd freaks out if you send the ready state too fast after the + // reload state and can kill Kanidmd as a result. + tokio::time::sleep(std::time::Duration::from_secs(5)).await; + #[cfg(target_os = "linux")] let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Ready]); + + info!("Reload complete"); } Some(()) = async move { let sigterm = tokio::signal::unix::SignalKind::user_defined1();