From 7c99ac2ba291dbe28caf1257963cd3dc935c9752 Mon Sep 17 00:00:00 2001 From: fufesou Date: Thu, 26 May 2022 17:07:00 +0800 Subject: [PATCH] fix_deadlock_general_service: fix deadlock when join general service. Signed-off-by: fufesou --- src/server/service.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/service.rs b/src/server/service.rs index 35cfdbd77..576c93262 100644 --- a/src/server/service.rs +++ b/src/server/service.rs @@ -89,7 +89,12 @@ impl> Service for ServiceTmpl { fn join(&self) { self.0.write().unwrap().active = false; - self.0.write().unwrap().handle.take().map(JoinHandle::join); + let handle = self.0.write().unwrap().handle.take(); + if let Some(handle) = handle { + if let Err(e) = handle.join() { + log::error!("Failed to join thread for service {}, {:?}", self.name(), e); + } + } } }