Add scheduler deadlock detection #15735

pull jamesob wants to merge 2 commits into bitcoin:master from jamesob:2019-04-serialize-scheduler changing 4 files +25 −0
  1. jamesob commented at 9:40 pm on April 3, 2019: member

    Related to #14289 and follows up on #15205. See a relevant IRC chat here: http://www.erisian.com.au/bitcoin-core-dev/log-2019-01-22.html

    This helps detect deadlocks in the scheduler (and by association validation interface callbacks) by adding a flag which causes the scheduler to execute tasks synchronously in the calling thread. It adds a Travis job that runs the functional test suite with this flag enabled.

    You can verify that the flag works as intended by applying this diff

     0diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp
     1index 44432cd0a1..bb4046f119 100644
     2--- a/src/test/validation_block_tests.cpp
     3+++ b/src/test/validation_block_tests.cpp
     4@@ -27,6 +27,7 @@ struct TestSubscriber : public CValidationInterface {
     5 
     6     void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override
     7     {
     8+        SyncWithValidationInterfaceQueue();
     9         BOOST_CHECK_EQUAL(m_expected_tip, pindexNew->GetBlockHash());
    10     }
    

    rebuilding with ./configure ... CPPFLAGS="... -DDEBUG_SERIALIZE_SCHEDULER", then running ./src/test/test_bitcoin -t validation_block_tests, and watching as the deadlock detector hulks out.

  2. Add -DDEBUG_SERIALIZE_SCHEDULER
    For use in test environments to detect deadlocks in
    CScheduler-managed tasks.
    6470af9d53
  3. Add a Travis job that checks for CScheduler deadlocks 64c06a489e
  4. jamesob commented at 6:23 pm on April 4, 2019: member
    This segfaults on functional test run at the moment due to a stack overflow thanks to scheduler.cpp:Repeat(), so I’m gonna think about a workaround.
  5. jamesob closed this on Apr 4, 2019

  6. pull[bot] referenced this in commit 2c35fe6238 on Apr 30, 2019
  7. DrahtBot locked this on Dec 16, 2021


jamesob


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me