Skip to content

Commit 7dc4062

Browse files
committed
fix: break when parsing invalid command
1 parent d62daf4 commit 7dc4062

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/run/runner/wall_time/perf/fifo.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::FifoCommand;
2+
use anyhow::Context;
23
use runner_shared::fifo::{RUNNER_ACK_FIFO, RUNNER_CTL_FIFO};
34
use std::path::PathBuf;
45
use tokio::io::{AsyncReadExt, AsyncWriteExt};
@@ -52,7 +53,9 @@ impl RunnerFifo {
5253
}
5354
}
5455

55-
let decoded = bincode::deserialize(&buffer)?;
56+
let decoded = bincode::deserialize(&buffer).with_context(|| {
57+
format!("Failed to deserialize FIFO command (len: {message_len}, data: {buffer:?})")
58+
})?;
5659
Ok(decoded)
5760
}
5861

src/run/runner/wall_time/perf/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,13 @@ impl PerfRunner {
296296
perf_ping_timeout = 1;
297297

298298
let result = tokio::time::timeout(Duration::from_secs(5), runner_fifo.recv_cmd()).await;
299-
let Ok(Ok(cmd)) = result else {
300-
continue;
299+
let cmd = match result {
300+
Ok(Ok(cmd)) => cmd,
301+
Ok(Err(e)) => {
302+
warn!("Failed to parse FIFO command: {e}");
303+
break;
304+
}
305+
Err(_) => continue,
301306
};
302307
debug!("Received command: {cmd:?}");
303308

0 commit comments

Comments
 (0)