diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-08-04 16:37:01 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-08-04 16:37:12 +0200 |
commit | 5b2d8661c906ea1bc7afd904aad9b04a691d86cd (patch) | |
tree | fc9badbf53d67926195085d64265a1c72fada333 /contrib | |
parent | 3308c61091b6b7cb22569f3abadea6d001295c90 (diff) | |
parent | 703b1e612a4bd4521e20ae21eb8fb7c19f4ef942 (diff) |
Merge bitcoin/bitcoin#22577: Close minor startup race between main and scheduler threads
703b1e612a4bd4521e20ae21eb8fb7c19f4ef942 Close minor startup race between main and scheduler threads (Larry Ruane)
Pull request description:
This is a low-priority bug fix. The scheduler thread runs `CheckForStaleTipAndEvictPeers()` every 45 seconds (EXTRA_PEER_CHECK_INTERVAL). If its first run happens before the active chain is set up (`CChain::SetTip()`), `bitcoind` will assert:
```
(...)
2021-07-28T22:16:49Z init message: Loading block index…
bitcoind: validation.cpp:4968: CChainState& ChainstateManager::ActiveChainstate() const: Assertion `m_active_chainstate' failed.
Aborted (core dumped)
```
I ran into this while using the debugger to investigate an unrelated problem. Single-stepping through threads with a debugger can cause the relative thread execution timing to be very different than usual. I don't think any automated tests are needed for this PR. I'll give reproduction steps in the next PR comment.
ACKs for top commit:
MarcoFalke:
cr ACK 703b1e612a4bd4521e20ae21eb8fb7c19f4ef942
tryphe:
tested ACK 703b1e612a4bd4521e20ae21eb8fb7c19f4ef942
0xB10C:
ACK 703b1e612a4bd4521e20ae21eb8fb7c19f4ef942
glozow:
code review ACK 703b1e612a4bd4521e20ae21eb8fb7c19f4ef942 - it makes sense to me to start peerman's background tasks here, after `chainstate->LoadChainTip()` and `node.connman->Start()` have been called.
Tree-SHA512: 9316ad768cba3b171f62e2eb400e3790af66c47d1886d7965edb38d9710fc8c8f8e4fb38232811c9346732ce311d39f740c5c2aaf5f6ca390ddc48c51a8d633b
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions