fix possible infinite loop in intro.cpp thread #2850

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:fix_intro changing 2 files +10 −1
  1. Diapolo commented at 11:11 AM on July 23, 2013: none
    • it was possible to trigger an infinite loop in FreespaceChecker::check() by simply removing the drive letter on Windows (which leads to an infinite loop in the FreespaceChecker thread)
    • this was caused by not checking if we make progress with parentDir.parent_path()
  2. BitcoinPullTester commented at 11:54 AM on July 23, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/e39ad7da9e993f93d115acefee8ec12c7cf198c3 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.

  3. in src/qt/intro.cpp:None in e39ad7da9e outdated
      64 | @@ -64,6 +65,14 @@ void FreespaceChecker::check()
      65 |      while(parentDir.has_parent_path() && !fs::exists(parentDir))
      66 |      {
      67 |          parentDir = parentDir.parent_path();
      68 | +        /* Prevent a deadlock by checking if we have something valid in parentDir */
      69 | +        if (!fs::is_regular_file(parentDir) && !fs::is_directory(parentDir) && !fs::is_symlink(parentDir))
    


    laanwj commented at 6:03 AM on July 26, 2013:

    Another way to make sure that the loop terminates is to make sure that it makes progress. Ie, continue only as long as parent_path makes the path shorter (it just chops off / or \ delimited parts anyway). These checks seem very arbitrary. A user could enter <existing_directory>/a/b/bitcoin, in which case both a and b don't exist yet so there will be "nothing valid" in parentDir.

    btw: This is not a "deadlock", but a garden variety infinite loop. Deadlock is a specific situation in which two threads contend for a lock while they hold another one, which is not the case here.


    Diapolo commented at 6:36 AM on July 26, 2013:

    I fixed the descriptions, now I need to rework the check.

  4. BitcoinPullTester commented at 7:01 AM on July 26, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/3fbf6b01ac605f934c3d7e24a90b1939fafa7897 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.

  5. fix possible infinite loop in intro.cpp thread
    - it was possible to trigger an infinite loop in FreespaceChecker::check() by
      simply removing the drive letter on Windows (which leads to an infinite
      loop in the FreespaceChecker thread)
    - this was caused by not checking if we make progress with
      parentDir.parent_path()
    5bc6d8e580
  6. Diapolo commented at 7:19 AM on July 26, 2013: none

    @laanwj Can you take another look, I'm now checking for progress.

  7. BitcoinPullTester commented at 7:56 AM on July 26, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/5bc6d8e5802500a6ffd737185f30283bc65eba58 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.

  8. laanwj referenced this in commit 6d89611c3a on Aug 1, 2013
  9. laanwj merged this on Aug 1, 2013
  10. laanwj closed this on Aug 1, 2013

  11. IntegralTeam referenced this in commit 0c2fdf4da8 on Jun 4, 2019
  12. DrahtBot 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-04-21 18:16 UTC

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