test_bitcoin: ./chain.h:261: uint256 CBlockIndex::GetBlockHash() const: Assertion `phashBlock != nullptr' failed. #27320

issue maflcko opened this issue on March 24, 2023
  1. maflcko commented at 9:31 AM on March 24, 2023: member

    https://cirrus-ci.com/task/6024293113397248?logs=ci#L3199

    Simulating node restart
    2023-03-23T20:11:01.824273Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk started
    2023-03-23T20:11:01.824318Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk completed (0.03ms)
    2023-03-23T20:11:01.824330Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk started
    2023-03-23T20:11:01.825668Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk completed (1.33ms)
    2023-03-23T20:11:01.825686Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
    2023-03-23T20:11:01.825704Z (mocktime: 2020-08-31T15:36:02Z) [test] [txdb.cpp:167] [BatchWrite] [coindb] Writing final batch of 0.00 MiB
    2023-03-23T20:11:01.825719Z (mocktime: 2020-08-31T15:36:02Z) [test] [txdb.cpp:169] [BatchWrite] [coindb] Committed 0 changed transaction outputs (out of 0) to coin database...
    2023-03-23T20:11:01.825732Z (mocktime: 2020-08-31T15:36:02Z) [test] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.03ms)
    2023-03-23T20:11:01.825744Z (mocktime: 2020-08-31T15:36:02Z) [test] [validationinterface.cpp:249] [ChainStateFlushed] [validation] Enqueuing ChainStateFlushed: block hash=696e92821f65549c7ee134edceeeeaaa4105647a3c4fd9f298c0aec0ab50425c
    Performing Load/Verify/Activate of chainstate
    test_bitcoin: ./chain.h:261: uint256 CBlockIndex::GetBlockHash() const: Assertion `phashBlock != nullptr' failed.
    make[3]: *** [Makefile:21821: test/validation_chainstatemanager_tests.cpp.test] Error 1
    
  2. maflcko commented at 9:32 AM on March 24, 2023: member

    On master @ 23056436461a8b3af1a504b9638c48e8c8170652

  3. mzumsande commented at 9:33 PM on March 24, 2023: contributor

    maybe not a cosmic ray after all (#26613)

  4. mzumsande commented at 6:49 PM on March 27, 2023: contributor

    I think the following may be happening: In the failed run, there is an UpdatedBlockTip scheduled in line 3169 that has not been processed yet:

    2023-03-23T20:11:01.813759Z (mocktime: 2020-08-31T15:36:01Z) [test] [validationinterface.cpp:201] [UpdatedBlockTip][validation] Enqueuing UpdatedBlockTip: new block hash=4fe08ff1d78843f1b6f0d2b80fee9af49b3c945368e585b8aed1807c89d14804 fork block
    

    Next, the test calls SimulateNodeRestart(), which resets the ChainstateManager and creates a new one. At last, the scheduler thread attempts to process the UpdatedBlockTip event, but the pointer to the CBlockIndex is no longer valid.

    If that makes sense, a call to SyncWithValidationInterfaceQueue() within SimulateNodeRestart() might fix this - will open a PR.

  5. fanquake referenced this in commit 86e7410b22 on Mar 28, 2023
  6. fanquake closed this on Mar 28, 2023

  7. sidhujag referenced this in commit 6aa17fe6c3 on Mar 28, 2023
  8. bitcoin locked this on Mar 27, 2024

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: 2026-04-17 06:13 UTC

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