Skip to content

Commit

Permalink
Fix potential deadlock in state_key::Entry::drop (#14670)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse authored Sep 20, 2024
1 parent 109814a commit 8eb8b52
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 8eb8b52

Please sign in to comment.