From 0bcb6b1bf6d2455d5edff8eb599b4688637ebfb4 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 11:28:29 +0100 Subject: [PATCH] fix(appd): signal all supervisors to abort on clean shutdown SessionRegistry::shutdown_all() clears abort_senders, dropping all oneshot senders. Each supervised process's abort_rx fires, causing supervise() to kill the child. A 200ms yield after shutdown_all gives the tokio runtime time to schedule the abort handling before the process exits and the socket file is removed. --- crates/weft-appd/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/weft-appd/src/main.rs b/crates/weft-appd/src/main.rs index 416ed30..f869290 100644 --- a/crates/weft-appd/src/main.rs +++ b/crates/weft-appd/src/main.rs @@ -93,6 +93,10 @@ impl SessionRegistry { pub(crate) fn broadcast(&self) -> &tokio::sync::broadcast::Sender { &self.broadcast } + + pub(crate) fn shutdown_all(&mut self) { + self.abort_senders.clear(); + } } #[tokio::main] @@ -175,6 +179,8 @@ async fn run() -> anyhow::Result<()> { } } + registry.lock().await.shutdown_all(); + tokio::time::sleep(tokio::time::Duration::from_millis(200)).await; let _ = std::fs::remove_file(&socket_path); Ok(()) }