Fix locking in GetTransaction. #6688

pull morcos wants to merge 1 commits into bitcoin:master from morcos:lock_GetTransaction changing 1 files +33 −35
  1. morcos commented at 9:55 PM on September 17, 2015: member

    GetTransaction needs to lock cs_main until ReadBlockFromDisk completes because the data inside CBlockIndex's can change since pruning. This lock was held by all calls to GetTransaction except rest_tx.

  2. sipa commented at 11:07 PM on September 17, 2015: member

    Concept ACk

  3. dcousens commented at 11:26 PM on September 17, 2015: contributor

    @morcos in this case, you can just remove that scoping block.

    utACK

  4. Fix locking in GetTransaction.
    GetTransaction needs to lock cs_main until ReadBlockFromDisk completes, the data inside CBlockIndex's can change since pruning.  This lock was held by all calls to GetTransaction except rest_tx.
    131c23d027
  5. laanwj commented at 12:59 AM on September 18, 2015: member

    This is unfortunate. Can we do reading the block from disk without lock, at least? E.g. the i/o itself. cs_main is extremely contended, it's not nice to hold it during longer operations.

    Though utACK anyway...

  6. laanwj added the label Bug on Sep 18, 2015
  7. morcos force-pushed on Sep 18, 2015
  8. morcos commented at 3:10 AM on September 18, 2015: member

    @dcousens oops, thanks.. also removed another unnecessary scoping block.

  9. dcousens commented at 8:43 AM on September 19, 2015: contributor

    utACK, agreed with @laanwj, but that is something we should address in another PR IMHO.

  10. laanwj merged this on Sep 23, 2015
  11. laanwj closed this on Sep 23, 2015

  12. laanwj referenced this in commit 4939eabb75 on Sep 23, 2015
  13. MarcoFalke locked this on Sep 8, 2021
Labels

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-22 09:15 UTC

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