Skip to content

Commit

Permalink
Merge pull request hyperledger-archives#1896 from boydjohnson/debug.b…
Browse files Browse the repository at this point in the history
…lock.managerlock

Fix BlockManager deadlock
  • Loading branch information
boydjohnson authored Oct 12, 2018
2 parents d1c2751 + a9650f9 commit 999e43f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions validator/src/journal/block_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ impl BlockManagerState {
.references_by_block_id
.write()
.expect("Acquiring reference write lock; lock poisoned");
let mut block_by_block_id = self
.block_by_block_id
.write()
.expect("Acquiring block pool write lock; lock poisoned");
let blockstore_by_name = self
.blockstore_by_name
.read()
Expand Down Expand Up @@ -227,10 +231,6 @@ impl BlockManagerState {
last_block.previous_block_id.clone(),
),
);
let mut block_by_block_id = self
.block_by_block_id
.write()
.expect("Acquiring block pool write lock; lock poisoned");
block_by_block_id.insert(last_block.header_signature.clone(), last_block.clone());

blocks_with_references.into_iter().for_each(|block| {
Expand All @@ -248,12 +248,7 @@ impl BlockManagerState {

COLLECTOR
.gauge("BlockManager.pool_size", None, None)
.set_value(
self.block_by_block_id
.read()
.expect("Acquiring block pool read lock; lock poisoned")
.len(),
);
.set_value(block_by_block_id.len());

Ok(())
}
Expand Down

0 comments on commit 999e43f

Please sign in to comment.