Skip to content

Commit 3fe978e

Browse files
phip1611tpressure
authored andcommitted
vmm: fix panic in http API when connecting GDB
This behavior is by the way well-known and also other code in Cloud Hypervisor uses this check with subsequent continue. Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
1 parent 9b02848 commit 3fe978e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vmm/src/api/http/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use std::collections::BTreeMap;
77
use std::error::Error;
88
use std::fs::File;
9+
use std::io::ErrorKind;
910
use std::os::fd::AsRawFd;
1011
use std::os::unix::io::{IntoRawFd, RawFd};
1112
use std::os::unix::net::UnixListener;
@@ -548,7 +549,12 @@ fn start_http_thread(
548549
server.start_server().unwrap();
549550

550551
loop {
551-
let n = outer_epoll.wait(-1, &mut events).unwrap();
552+
let n = match outer_epoll.wait(-1, &mut events) {
553+
Ok(n) => n,
554+
// Can for example happen when connecting a debugger.
555+
Err(e) if e.kind() == ErrorKind::Interrupted => continue,
556+
Err(e) => panic!("failed to wait for events: {e}"),
557+
};
552558
for ev in events.iter().take(n) {
553559
match ev.data() {
554560
HTTP_EPOLL_TOKEN => {

0 commit comments

Comments
 (0)