mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
@@ -689,7 +689,7 @@ pub struct Mem {
|
||||
config: Arc<Mutex<VirtioMemConfig>>,
|
||||
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>,
|
||||
}
|
||||
@@ -854,7 +854,11 @@ impl VirtioDevice for Mem {
|
||||
let mut epoll_threads = Vec::new();
|
||||
thread::Builder::new()
|
||||
.name("virtio_mem".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 virtio-mem epoll thread: {}", e);
|
||||
|
||||
Reference in New Issue
Block a user