LoadExternalBlockFile is missing locking #6691

issue morcos opened this issue on September 18, 2015
  1. morcos commented at 3:28 AM on September 18, 2015: member

    LoadExternalBlockFile accesses mapBlockIndex without any locks. But mapBlockIndex could be in the process of being modified. The fImporting flag should protect from a p2p message causing a modification, but submitblock can be modifying mapBlockIndex at the same time as LoadExternalBlockFile is reading it.

    In addition LoadExternalBlockFile calls ReadBlockFromDisk which really needs some of the variables in CBlockIndex which are accessed by GetBlockPos to be protected. All other reads of them happen to be protected by cs_main.

  2. laanwj added the label Bug on Sep 22, 2015
  3. morcos commented at 8:41 PM on October 19, 2015: member

    A related, but somewhat separate issue is that during reindexing it should not be possible to write data to the block files. The database of which files contain which blocks and where space exists for new blocks to be written is still in the process of being created. A submitblock RPC call during a reindexing seems like it would cause significant problems.

  4. morcos cross-referenced this on Nov 5, 2015 from issue Always flush block and undo when switching to new file by sipa
  5. meshcollider commented at 3:35 AM on March 14, 2018: contributor

    I believe this was resolved in #11041 @morcos is your second comment still an issue, and if so would you like to open it as a separate issue thread and close this one?

  6. meshcollider closed this on Oct 14, 2018

  7. bitcoin locked this on Sep 8, 2021

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-05-19 06:55 UTC