From ff2765257323dfa28c4b144f588d93d65fbebec7 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Thu, 26 Nov 2026 11:09:13 +0100 Subject: [PATCH] fix(executor): remove runner FIFOs when the run ends RunnerFifo created /tmp/runner.ctl.fifo and /tmp/runner.ack.fifo but never removed them. Integrations treat existing FIFOs as a live runner and stall for about 4 s per benchmark process on the next run, for example a walltime run with the profiler disabled, which never touches the FIFOs. Unlink both FIFOs in a Drop impl, covering walltime, memory and analysis runs, and share the unlink with create_fifo. Fixes #635 --- src/executor/shared/fifo.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/executor/shared/fifo.rs b/src/executor/shared/fifo.rs index bdff3cd61..0db0afe4d 100644 --- a/src/executor/shared/fifo.rs +++ b/src/executor/shared/fifo.rs @@ -14,9 +14,13 @@ use tokio::net::unix::pipe::Receiver as TokioPipeReader; use tokio::net::unix::pipe::Sender as TokioPipeSender; use tokio_util::codec::{FramedRead, LengthDelimitedCodec}; +fn remove_fifo(path: &Path) { + let _ = nix::unistd::unlink(path); +} + fn create_fifo>(path: P) -> anyhow::Result<()> { // Remove the previous FIFO (if it exists) - let _ = nix::unistd::unlink(path.as_ref()); + remove_fifo(path.as_ref()); // Create the FIFO with RWX permissions for the owner nix::unistd::mkfifo(path.as_ref(), nix::sys::stat::Mode::S_IRWXU)?; @@ -79,6 +83,8 @@ impl FifoBenchmarkData { } pub struct RunnerFifo { + ctl_path: PathBuf, + ack_path: PathBuf, ack_fifo: TokioPipeSender, ctl_reader: FramedRead, } @@ -125,6 +131,8 @@ impl RunnerFifo { let ctl_reader = FramedRead::new(ctl_fifo, codec); Ok(Self { + ctl_path: ctl_path.to_path_buf(), + ack_path: ack_path.to_path_buf(), ack_fifo, ctl_reader, }) @@ -285,6 +293,13 @@ impl RunnerFifo { } } +impl Drop for RunnerFifo { + fn drop(&mut self) { + remove_fifo(&self.ctl_path); + remove_fifo(&self.ack_path); + } +} + #[cfg(all(test, target_os = "linux"))] mod tests { use super::*; @@ -321,4 +336,19 @@ mod tests { "recv_cmd should be cancel-safe: expected Ok(Ok(Ack)), got: {second:?}" ); } + + #[tokio::test] + async fn drop_removes_fifos() { + let temp_dir = tempfile::tempdir().unwrap(); + let ctl_path = temp_dir.path().join("ctl_fifo"); + let ack_path = temp_dir.path().join("ack_fifo"); + + let fifo = RunnerFifo::open(&ctl_path, &ack_path).unwrap(); + assert!(ctl_path.exists() && ack_path.exists()); + + drop(fifo); + + assert!(!ctl_path.exists(), "ctl FIFO should be removed on drop"); + assert!(!ack_path.exists(), "ack FIFO should be removed on drop"); + } }