Close LevelDB cursor in case of an error loading blocks #4656

pull rnicoll wants to merge 1 commits into bitcoin:master from rnicoll:master-cursor changing 1 files +2 −4
  1. rnicoll commented at 10:07 pm on August 7, 2014: contributor

    Close LevelDB cursor in case of an error loading blocks. Otherwise an assertion error occurs when the database is deleted (around line 938 of init.cpp).

    I don’t have a simple test-case for this for Bitcoin, apologies; the problem occurs in Dogecoin 1.8 due to block length changes introduced for AuxPoW support, and this is effectively merging that change upstream.

  2. sipa commented at 10:32 pm on August 7, 2014: member
    Nice catch, but I’d rather using a scoped_ptr for the LevelDB pointer, guaranteeing that every code path deletes it safely?
  3. laanwj added the label UTXO Db and Indexes on Aug 8, 2014
  4. rnicoll commented at 7:54 pm on August 8, 2014: contributor
    Done, and found another case that needed the same change too.
  5. BitcoinPullTester commented at 8:07 pm on August 8, 2014: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4656_53b3fddfc5ff5b5600b665c15de3e186c1c0bdce/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  6. sipa commented at 9:36 pm on August 8, 2014: member
    Untested ACK
  7. laanwj commented at 12:10 pm on August 13, 2014: member

    ACK on code changes. Can you change the commit message to the following format:

    0Changed LevelDB cursors to use scoped pointers to ensure destruction when going out of scope.
    1
    2This corrects a bug where an exception thrown reading from the database causes the cursor to
    3be left open, which causes an assertion error to occur when the database is deleted (around
    4line 938 of init.cpp).
    

    Ie, a header line followed by an empty line, then the rest of the description.

    Otherwise a tool such as git log with abbreviated commits will show the whole commit message instead of just the title. Thanks!

  8. Changed LevelDB cursors to use scoped pointers to ensure destruction when going out of scope.
    This corrects a bug where an exception thrown reading from the database causes the cursor to
    be left open, which causes an assertion error to occur when the database is deleted (around
    line 938 of init.cpp).
    5cbda4f10f
  9. rnicoll commented at 2:28 pm on August 16, 2014: contributor
    Done, and noted for future reference, thanks.
  10. laanwj merged this on Aug 17, 2014
  11. laanwj closed this on Aug 17, 2014

  12. laanwj referenced this in commit b3ec053082 on Aug 17, 2014
  13. rnicoll deleted the branch on Aug 29, 2014
  14. MarcoFalke 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: 2024-11-17 21:12 UTC

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