Skip to content

Commit

Permalink
[cp][aptos-release-v1.20] Fix potential deadlock in state_key::Entry:…
Browse files Browse the repository at this point in the history
…:drop (#14710)

Co-authored-by: Alden Hu <msmouse@gmail.com>
  • Loading branch information
github-actions[bot] and msmouse authored Sep 20, 2024
1 parent d891f37 commit 844caff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/src/state_store/state_key/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ where
let mut locked = self.inner.write();
if let Some(map2) = locked.get_mut(key1) {
if let Some(entry) = map2.get(key2) {
if entry.upgrade().is_none() {
if entry.strong_count() == 0 {
map2.remove(key2);
if map2.is_empty() {
locked.remove(key1);
}
}
}
if map2.is_empty() {
locked.remove(key1);
}
}
}

Expand Down

0 comments on commit 844caff

Please sign in to comment.