qa: Prevent concurrency issues reading .cookie file #15771

pull promag wants to merge 1 commits into bitcoin:master from promag:2019-04-retry-open-cookie changing 1 files +3 −1
  1. promag commented at 7:10 PM on April 8, 2019: member

    Hopefully fixes #15733.

  2. fanquake added the label Tests on Apr 8, 2019
  3. in test/functional/test_framework/util.py:334 in 3709a699b7 outdated
     335 | -            userpass = f.read()
     336 | -            split_userpass = userpass.split(':')
     337 | -            user = split_userpass[0]
     338 | -            password = split_userpass[1]
     339 | +    cookie = os.path.join(datadir, "regtest", ".cookie")
     340 | +    wait_until(lambda: can_read_file(cookie), timeout=5)
    


    MarcoFalke commented at 7:56 PM on April 8, 2019:

    I believe this method is not allowed to block, it must return a result immediately

    Can be fixed by keeping the previous if-logic


    promag commented at 8:17 PM on April 8, 2019:

    I believe this method is not allowed to block, it must return a result immediately

    Why not?


    MarcoFalke commented at 8:21 PM on April 8, 2019:

    See wait_for_rpc_connection, which calls this method


    promag commented at 10:24 PM on April 8, 2019:

    Thanks, wait_for_rpc_connection already retries so I've changed this remove the early checks and just try opening the cookie file.

  4. promag force-pushed on Apr 8, 2019
  5. promag renamed this:
    qa: Retry opening .cookie files
    qa: Prevent concurrency issues reading .cookie file
    on Apr 8, 2019
  6. MarcoFalke commented at 10:36 PM on April 8, 2019: member

    utACK cc3bee31cc8eeeba7ab2e0f3d53b004d03fb1ab9

  7. qa: Prevent concurrency issues reading .cookie file 90bce24576
  8. in test/functional/test_framework/util.py:332 in cc3bee31cc outdated
     328 |          with open(os.path.join(datadir, "regtest", ".cookie"), 'r', encoding="ascii") as f:
     329 |              userpass = f.read()
     330 |              split_userpass = userpass.split(':')
     331 |              user = split_userpass[0]
     332 |              password = split_userpass[1]
     333 | +    except FileNotFoundError:
    


    MarcoFalke commented at 1:13 PM on April 9, 2019:
        except OSError:
    

    To also catch PermissionError, to not regress on 2753285be72dd051cf2987ca5c80d0b149914020?

    See https://docs.python.org/3/library/exceptions.html#os-exceptions


    promag commented at 1:28 PM on April 9, 2019:

    Done.

  9. promag force-pushed on Apr 9, 2019
  10. MarcoFalke merged this on Apr 9, 2019
  11. MarcoFalke closed this on Apr 9, 2019

  12. MarcoFalke referenced this in commit f9f6c11a74 on Apr 9, 2019
  13. promag deleted the branch on Apr 22, 2019
  14. Munkybooty referenced this in commit 1d76cc7537 on Sep 30, 2021
  15. Munkybooty referenced this in commit 14b7de5618 on Oct 7, 2021
  16. Munkybooty referenced this in commit 13653ffc00 on Oct 12, 2021
  17. Munkybooty referenced this in commit 282dc46401 on Oct 16, 2021
  18. Munkybooty referenced this in commit 114462bbd0 on Oct 20, 2021
  19. Munkybooty referenced this in commit 30454896e6 on Oct 21, 2021
  20. Munkybooty referenced this in commit 42e655517c on Oct 23, 2021
  21. PastaPastaPasta referenced this in commit 7716ff4086 on Oct 24, 2021
  22. PastaPastaPasta referenced this in commit 5aebc257cc on Oct 25, 2021
  23. pravblockc referenced this in commit 767a7d2139 on Nov 18, 2021
  24. MarcoFalke locked this on Dec 16, 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-17 06:14 UTC

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