Skip to content

Commit 58a58be

Browse files
committed
lfm: the driver's sampler and node builder never panic
HostSampler::stop expected its thread to be there and not to have panicked, and the node builder expected a slot it had just filled: both are on the production path now that the whole-block driver runs in the CLI. A sampler that could not run reports no peak; a node whose program never arrived is the builder's error.
1 parent c94601a commit 58a58be

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎prover/src/lfm/block_tree_pipeline.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ impl Pipe {
429429
emit += secs;
430430
ready[l][jj] = Some(program);
431431
}
432-
ready[lv][j].take().expect("filled above")?
432+
ready[lv][j].take().ok_or_else(|| {
433+
format!("level {} node {j}: its program never arrived", lv + 1)
434+
})??
433435
}
434436
};
435437
let (artifacts, derived) = built(&program)?;

‎prover/src/lfm/tree_run.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,11 @@ impl HostSampler {
389389
/// `(peak GiB, argmax UNIX seconds)` over this sampler's window.
390390
pub(crate) fn stop(mut self) -> (f64, f64) {
391391
self.stop.store(true, std::sync::atomic::Ordering::Relaxed);
392+
// A sampler that could not run reports no peak, at the time it stopped.
392393
self.handle
393394
.take()
394-
.expect("a sampler is stopped once")
395-
.join()
396-
.expect("the sampler thread must not panic")
395+
.and_then(|h| h.join().ok())
396+
.unwrap_or_else(|| (0.0, unix_now()))
397397
}
398398
}
399399

0 commit comments

Comments
 (0)