From 099362cd42e7057f971d622e77da768d62e7c10e Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Tue, 7 Apr 2026 09:52:12 -0400 Subject: [PATCH] fix(nextest): let shared test server reap run workers Give the harness longer to stop the shared test server than the server itself uses to shut down active run workers. This prevents session cleanup from SIGKILLing the server before it can terminate worker process groups, which was leaving orphaned `fabro running` subprocesses behind. --- lib/crates/fabro-test/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/crates/fabro-test/src/lib.rs b/lib/crates/fabro-test/src/lib.rs index 5b0b31475..679bd16c1 100644 --- a/lib/crates/fabro-test/src/lib.rs +++ b/lib/crates/fabro-test/src/lib.rs @@ -576,7 +576,7 @@ fn stop_test_server(server: &ServerPaths) { fabro_proc::sigterm(pid); let poll = std::time::Duration::from_millis(50); - let timeout = std::time::Duration::from_secs(3); + let timeout = test_server_stop_timeout(); let mut elapsed = std::time::Duration::ZERO; while elapsed < timeout && fabro_proc::process_alive(pid) { std::thread::sleep(poll); @@ -590,6 +590,12 @@ fn stop_test_server(server: &ServerPaths) { let _ = std::fs::remove_file(&record_path); } +fn test_server_stop_timeout() -> std::time::Duration { + // Allow the real server to finish its own 5s worker-shutdown grace before + // we escalate and risk orphaning active run workers. + std::time::Duration::from_secs(8) +} + fn shared_server_paths(root: &Path) -> ServerPaths { ServerPaths { root: root.to_path_buf(), @@ -1737,6 +1743,14 @@ mod tests { assert!(create_args.contains(&context.test_case_label())); } + #[test] + fn stop_test_server_timeout_exceeds_server_worker_grace() { + assert!( + test_server_stop_timeout() >= std::time::Duration::from_secs(6), + "test harness must give the server longer than its 5s worker shutdown grace" + ); + } + struct EnvGuard { key: &'static str, original: Option,