Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Synchronize wait group access in blockchain #23673

Closed

Commits on Oct 1, 2021

  1. core: Synchronize wait group access in blockchain

    When using a wg Add is intended to be called before Wait, calling Add
    and Wait concurrently leads to data races.
    
    The blockchain calls wg.Add in many exported methods such as chain
    insert methods and it seems highly unlikely that they will be called by
    the same goroutine that calls Stop (where wg.Wait is called), so to
    avoid data races on shutdown the acesses to Add and Wait need to be
    synchronized.
    
    The solution is to lock over calls to Add and Wait.
    
    A golang issue with more details about this problem
    golang/go#23842
    piersy committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    106c3a2 View commit details
    Browse the repository at this point in the history