From 7dc40628afc9145c7da1ca373d864bc052f07dec Mon Sep 17 00:00:00 2001 From: not-matthias Date: Fri, 3 Oct 2025 12:18:50 +0200 Subject: [PATCH] fix: break when parsing invalid command --- src/run/runner/wall_time/perf/fifo.rs | 5 ++++- src/run/runner/wall_time/perf/mod.rs | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/run/runner/wall_time/perf/fifo.rs b/src/run/runner/wall_time/perf/fifo.rs index 996b9827..5ba2c088 100644 --- a/src/run/runner/wall_time/perf/fifo.rs +++ b/src/run/runner/wall_time/perf/fifo.rs @@ -1,4 +1,5 @@ use super::FifoCommand; +use anyhow::Context; use runner_shared::fifo::{RUNNER_ACK_FIFO, RUNNER_CTL_FIFO}; use std::path::PathBuf; use tokio::io::{AsyncReadExt, AsyncWriteExt}; @@ -52,7 +53,9 @@ impl RunnerFifo { } } - let decoded = bincode::deserialize(&buffer)?; + let decoded = bincode::deserialize(&buffer).with_context(|| { + format!("Failed to deserialize FIFO command (len: {message_len}, data: {buffer:?})") + })?; Ok(decoded) } diff --git a/src/run/runner/wall_time/perf/mod.rs b/src/run/runner/wall_time/perf/mod.rs index f3b5d0f6..7cefc097 100644 --- a/src/run/runner/wall_time/perf/mod.rs +++ b/src/run/runner/wall_time/perf/mod.rs @@ -296,8 +296,13 @@ impl PerfRunner { perf_ping_timeout = 1; let result = tokio::time::timeout(Duration::from_secs(5), runner_fifo.recv_cmd()).await; - let Ok(Ok(cmd)) = result else { - continue; + let cmd = match result { + Ok(Ok(cmd)) => cmd, + Ok(Err(e)) => { + warn!("Failed to parse FIFO command: {e}"); + break; + } + Err(_) => continue, }; debug!("Received command: {cmd:?}");