[qa] util: Poll cookie file size before reading #11129

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:Mf1708-qaPollCookie changing 1 files +9 −4
  1. MarcoFalke commented at 9:13 PM on August 24, 2017: member

    I have been seeing empty cookie files on travis infrastructure, but couldn't reproduce the issue locally. I assume it takes a bit longer to flush the file on travis. Thus, a sleep should work around that.

  2. [qa] util: Poll cookie file size before reading fabfeaee6d
  3. MarcoFalke added the label Tests on Aug 24, 2017
  4. in test/functional/test_framework/util.py:253 in fabfeaee6d
     252 | -        with open(os.path.join(datadir, "regtest", ".cookie"), 'r') as f:
     253 | +    if os.path.isfile(file_cookie):
     254 | +        while os.path.getsize(file_cookie) != len('__cookie__:') + 64:
     255 | +            # Wait for the file to be flushed
     256 | +            time.sleep(0.05)
     257 | +        with open(file_cookie, 'r') as f:
    


    laanwj commented at 10:22 AM on August 25, 2017:

    Concept ACK, though I don't like doing this polling in get_auth_cookie itself - my preference would be to throw a AuthCookieIncomplete error or such, catch that in wait_for_rpc_connection and keep the polling restricted to there.

    Edit: it could even just raise ValueError("No RPC credentials") - that's already checked for in that loop.

  5. laanwj commented at 10:31 AM on August 25, 2017: member

    Thinking about this some more, an even better option would be to use POSIX rename atomicity at the bitcoind side to create a working cookie atomically:

    • Write .cookie.tmp, close file
    • Rename .cookie.tmp to .cookie

    See #11131.

  6. laanwj referenced this in commit 43e7dcbcf0 on Aug 25, 2017
  7. MarcoFalke closed this on Aug 25, 2017

  8. MarcoFalke deleted the branch on Aug 25, 2017
  9. laanwj referenced this in commit e413f1dc28 on Aug 25, 2017
  10. laanwj referenced this in commit 82dd7195e1 on Aug 25, 2017
  11. laanwj referenced this in commit c7229ac36e on Aug 28, 2017
  12. MarcoFalke referenced this in commit b278a43646 on Oct 3, 2017
  13. HashUnlimited referenced this in commit 8958465398 on Mar 9, 2018
  14. PastaPastaPasta referenced this in commit 2f12d50751 on Sep 19, 2019
  15. PastaPastaPasta referenced this in commit 900c6ae316 on Sep 23, 2019
  16. PastaPastaPasta referenced this in commit 126034e9dc on Sep 24, 2019
  17. codablock referenced this in commit 6ec77c0a71 on Sep 25, 2019
  18. barrystyle referenced this in commit e856e38ff4 on Jan 22, 2020
  19. 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-13 15:15 UTC

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