From 0236ccee9e6bc0932c08f4270c346ad21178f2d1 Mon Sep 17 00:00:00 2001 From: BurtonQin Date: Thu, 4 Jun 2020 23:37:54 +0800 Subject: [PATCH] store: fix deadlock caused by conflicting lock order Signed-off-by: BurtonQin --- src/store/fst.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/store/fst.rs b/src/store/fst.rs index b4493907..3556626b 100644 --- a/src/store/fst.rs +++ b/src/store/fst.rs @@ -197,10 +197,11 @@ impl StoreFSTPool { // Notice: this prevents store to be acquired from any context let _access = GRAPH_ACCESS_LOCK.write().unwrap(); + let graph_pool_read = GRAPH_POOL.read().unwrap(); let graph_consolidate_read = GRAPH_CONSOLIDATE.read().unwrap(); for key in &*graph_consolidate_read { - if let Some(store) = GRAPH_POOL.read().unwrap().get(&key) { + if let Some(store) = graph_pool_read.get(&key) { let not_consolidated_for = store .last_consolidated .read()