Skip to content

Commit f6beb27

Browse files
committed
example(uffd): dont panic if read(2) from uffd returns -EAGAIN
Started seeing the below failure in test_population_latency: thread 'main' panicked at .../uffd/fault_all_handler.rs:41:18: uffd_msg not ready note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace I am not entierly sure how this can happen, because the read from the uffd is supposed to be blocking, but maybe it's a weird interaction with the fault-all behavior (e.g. there was a uffd event queues, but because we faulted everything it got cancelled again?), so let's just try going back to read(2) if we dont read anything. Signed-off-by: Patrick Roy <[email protected]>
1 parent dc00752 commit f6beb27

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/firecracker/examples/uffd/fault_all_handler.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ fn main() {
3535
runtime.run(
3636
|uffd_handler: &mut UffdHandler| {
3737
// Read an event from the userfaultfd.
38-
let event = uffd_handler
39-
.read_event()
40-
.expect("Failed to read uffd_msg")
41-
.expect("uffd_msg not ready");
38+
let Some(event) = uffd_handler.read_event().expect("Failed to read uffd_msg") else {
39+
return;
40+
};
4241

4342
if let userfaultfd::Event::Pagefault { addr, .. } = event {
4443
let bit =

0 commit comments

Comments
 (0)