diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index a866de0f2..cd09bbdce 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1454,8 +1454,22 @@ impl<'a> Vm<'a> { } 'outer: loop { - let num_events = - epoll::wait(epoll_fd, -1, &mut events[..]).map_err(Error::EpollError)?; + let num_events = match epoll::wait(epoll_fd, -1, &mut events[..]) { + Ok(res) => res, + Err(e) => { + if e.kind() == io::ErrorKind::Interrupted { + // It's well defined from the epoll_wait() syscall + // documentation that the epoll loop can be interrupted + // before any of the requested events occurred or the + // timeout expired. In both those cases, epoll_wait() + // returns an error of type EINTR, but this should not + // be considered as a regular error. Instead it is more + // appropriate to retry, by calling into epoll_wait(). + continue; + } + return Err(Error::EpollError(e)); + } + }; for event in events.iter().take(num_events) { let dispatch_idx = event.data as usize;