Skip to content

Conversation

@codablock
Copy link

@codablock codablock commented Mar 23, 2020

This backports bitcoin#12266 and bitcoin#13894, which is necessary due to the move of signal handling into the scheduler. This causes a lot more work being done in the scheduler thread, making it a lot more likely to have pending tasks while in shutdown, which in turn might cause crashes on shutdown.

This should also fix test failures like in https://gitlab.com/dashpay/dash/-/jobs/481521254

laanwj added 2 commits March 23, 2020 12:42
…ead of per-app

082a61c Move scheduler/threadGroup into common-init instead of per-app (Matt Corallo)

Pull request description:

  This resolves bitcoin#12229 which pointed out a shutdown deadlock due to
  scheduler/checkqueue having been shut down while network message
  processing is still running.

Tree-SHA512: 0c0a76113996b164b0610d3b8c40b396f3e384d165bf098768e31fe3701b00763d0d810ef24702387e2e936fefb9fb900a6225f7417bb0175b585f365d542660
faab631 shutdown: Stop threads before resetting ptrs (MarcoFalke)

Pull request description:

  On shutdown some threads would continue to run after or during a pointer reset. This leads to occasional segfaults on shutdown.

  Fix this by resetting the smart pointers after all threads that might read from them have been stopped.

  This should fix:
  * A segfault in the txindex thread, that occurs when the txindex destructor is done, but the thread was not yet stopped (as this is done in the base index destructor)
  * A segfault in the scheduler thread, which dereferences conman. (e.g. CheckForStaleTipAndEvictPeers)

Tree-SHA512: abbcf67fadd088e10fe8c384fadfb90bb115d5317145ccb5363603583b320efc18131e46384f55a9bc574969013dfcbd08c49e0d42c004ed7212eca193858ab2
@codablock codablock added this to the 16 milestone Mar 23, 2020
@codablock codablock force-pushed the pr_fix_scheduler_shutdown branch from bac693d to 35b041e Compare March 23, 2020 11:45
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

Few tiny issues

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@codablock codablock merged commit 4e8f4ea into dashpay:develop Mar 24, 2020
@codablock codablock deleted the pr_fix_scheduler_shutdown branch March 24, 2020 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants