From 4a239383adf4f357b0424fabbcc58c5f290948dd Mon Sep 17 00:00:00 2001 From: Neng Li Date: Thu, 28 Dec 2023 21:10:53 +0800 Subject: [PATCH] fix(interactive): fix dead lock caused by write lock (#3459) ## What do these changes do? ## Related issue number Fixes https://github.com/alibaba/GraphScope/issues/3450 --- .../executor/engine/pegasus/pegasus/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/interactive_engine/executor/engine/pegasus/pegasus/src/lib.rs b/interactive_engine/executor/engine/pegasus/pegasus/src/lib.rs index bc3a7dc1465d..9c6e9ec08db4 100644 --- a/interactive_engine/executor/engine/pegasus/pegasus/src/lib.rs +++ b/interactive_engine/executor/engine/pegasus/pegasus/src/lib.rs @@ -264,8 +264,11 @@ where { init_env(); let cancel_hook = sink.get_cancel_hook().clone(); - let mut lock = JOB_CANCEL_MAP.write().expect("lock poisoned"); - lock.insert(conf.job_id, cancel_hook); + if let Ok(mut lock) = JOB_CANCEL_MAP.write() { + lock.insert(conf.job_id, cancel_hook); + } else { + return Err(BuildJobError::from("JOB_CANCEL_MAP is poisoned;"))?; + } let peer_guard = Arc::new(AtomicUsize::new(0)); let conf = Arc::new(conf); let workers = allocate_local_worker(&conf)?;