Skip to content

Commit

Permalink
cherry-pick: core: improve shutdown synchronization in BlockChain (et…
Browse files Browse the repository at this point in the history
…hereum#22853)

This change removes misuses of sync.WaitGroup in BlockChain. Before this change,
block insertion modified the WaitGroup counter in order to ensure that Stop would wait
for pending operations to complete. This was racy and could even lead to crashes
if Stop was called at an unfortunate time. The issue is resolved by adding a specialized
'closable' mutex, which prevents chain modifications after stopping while also
synchronizing writers with each other.

Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
2 people authored and piersy committed Dec 15, 2021
1 parent 7c46396 commit e414f5f
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 58 deletions.

0 comments on commit e414f5f

Please sign in to comment.