virtio-devices: Print out worker thread errors

As we never join the spawned virtio-devices worker threads, the error
returned from each worker thread is lost. For now, we simply print out
the error from each worker thread.

Fixes: #1551

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2020-08-17 12:45:17 -07:00
committed by Sebastien Boeuf
parent df30b23f0c
commit de3b17d948
7 changed files with 52 additions and 24 deletions

View File

@@ -305,7 +305,7 @@ pub struct Vsock<B: VsockBackend> {
acked_features: u64,
queue_evts: Option<Vec<EventFd>>,
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
epoll_threads: Option<Vec<thread::JoinHandle<result::Result<(), EpollHelperError>>>>,
epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
paused: Arc<AtomicBool>,
paused_sync: Arc<Barrier>,
path: PathBuf,
@@ -486,7 +486,11 @@ where
let mut epoll_threads = Vec::new();
thread::Builder::new()
.name("virtio_vsock".to_string())
.spawn(move || handler.run(paused, paused_sync))
.spawn(move || {
if let Err(e) = handler.run(paused, paused_sync) {
error!("Error running worker: {:?}", e);
}
})
.map(|thread| epoll_threads.push(thread))
.map_err(|e| {
error!("failed to clone the vsock epoll thread: {}", e);