Fix race condition on test node shutdown #6509

pull casey wants to merge 1 commits into bitcoin:master from casey:comptool-race-condition changing 1 files +48 −46
  1. casey commented at 6:54 PM on August 3, 2015: contributor

    This fixes a race condition where the block store or the transaction store might be accessed after being closed. To fix this, we wait until all connections are closed before closing the stores.

    This race condition is tricky to trigger, but I hit it when writing an extended block acceptance test.

  2. jonasschnelli cross-referenced this on Aug 4, 2015 from issue Code refractored in order to follow best coding practices by defijesus
  3. laanwj added the label Tests on Aug 5, 2015
  4. sdaftuar commented at 3:15 PM on August 5, 2015: member

    utACK

  5. Fix race condition on test node shutdown 45a6cce971
  6. in qa/rpc-tests/test_framework/comptool.py:None in 12d9715966 outdated
     169 | +            test_node.add_connection(self.connections[-1])
     170 | +
     171 | +    def wait_for_disconnections(self):
     172 | +        def disconnected():
     173 | +            return all(node.closed for node in self.test_nodes)
     174 | +        wait_until(disconnected, timeout=10)
    


    laanwj commented at 7:46 AM on August 12, 2015:

    Maybe return wait_until so that callers know whether it succeeded or timed out? (same for other wait_for_XXX)


    casey commented at 3:03 PM on August 12, 2015:

    Seems reasonable to me, changed.

  7. laanwj merged this on Aug 17, 2015
  8. laanwj closed this on Aug 17, 2015

  9. laanwj referenced this in commit bb4faee21e on Aug 17, 2015
  10. laanwj cross-referenced this on Aug 21, 2015 from issue Add p2p-fullblocktest.py by casey
  11. dagurval cross-referenced this on Aug 9, 2017 from issue Add comptool.RejectResult by dagurval
  12. 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-20 06:55 UTC