Skip to content

Conversation

@ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Mar 25, 2022

BlockManager::m_block_tree_db is protected by cs_main, so take the
cs_main lock while accessing it.

BlockManager::m_block_tree_db is protected by cs_main, so take the
cs_main lock while accessing it.
@ajtowns
Copy link
Contributor Author

ajtowns commented Mar 25, 2022

The use of the lambda in Assert and the fact that cs_main is a global lock rather than scoped within a class means that clang's thread safety checks don't catch this. cf #24654

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 0346c26

@maflcko
Copy link
Member

maflcko commented Mar 25, 2022

The access is before any other threads are started (import blocks, p2p, rpc, ...), so I tagged it with "refactoring".

@maflcko maflcko merged commit f10b24a into bitcoin:master Mar 25, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 2, 2022
0346c26 init: add missing cs_main lock (Anthony Towns)

Pull request description:

  `BlockManager::m_block_tree_db` is protected by `cs_main`, so take the
  `cs_main` lock while accessing it.

ACKs for top commit:
  jonatack:
    Code review ACK 0346c26

Tree-SHA512: d6dff0b2d58871c7fbb281558b59fa9ad26fa75b3ceca9232277fc49ab795325e5ac3d266db49e7bda33da6de0b014b1bdebdf2c2c4347d43e50c0433a2cf06c
@bitcoin bitcoin locked and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants