qa: Close SQLite connection properly #28204

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:230802-sqlite changing 1 files +3 −1
  1. hebasto commented at 6:34 pm on August 2, 2023: member

    This PR is a follow-up for #26462 that introduced a bug on Windows:

    0>test\functional\wallet_descriptor.py
    1...
    2PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
    3...
    

    From sqlite3 Python module docs:

    Connection object used as context manager only commits or rollbacks transactions, so the connection object should be closed manually.

  2. qa: Close SQLite connection properly
    Connection object used as context manager only commits or rollbacks
    transactions, so the connection object should be closed manually.
    
    Fixes the following error on Windows:
    ```
    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ...
    ```
    703b758e18
  3. DrahtBot commented at 6:34 pm on August 2, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK theStack, MarcoFalke

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Aug 2, 2023
  5. theStack approved
  6. theStack commented at 7:13 pm on August 2, 2023: contributor

    utACK 703b758e187492d4752270cd9922eaf0af20e2d0

    Thanks for fixing! Can’t reproduce the error locally as I don’t have a Windows machine available, but the change looks correct to me and is in line with the Python documentation (https://docs.python.org/3/library/sqlite3.html#sqlite3-connection-context-manager).

  7. maflcko commented at 5:52 am on August 3, 2023: member
    lgtm ACK 703b758e187492d4752270cd9922eaf0af20e2d0
  8. maflcko commented at 5:55 am on August 3, 2023: member
    Interesting that this isn’t caught on Windows in Cirrus CI? https://cirrus-ci.com/task/5010562627665920?logs=functional_tests#L210
  9. hebasto commented at 7:13 am on August 3, 2023: member

    Interesting that this isn’t caught on Windows in Cirrus CI? cirrus-ci.com/task/5010562627665920?logs=functional_tests#L210

    The reason of that is the --nocleanup option: https://github.com/bitcoin/bitcoin/blob/2fa60f0b683cefd7956273986dafe3bde00c98fd/.cirrus.yml#L188

  10. fanquake merged this on Aug 3, 2023
  11. fanquake closed this on Aug 3, 2023

  12. hebasto deleted the branch on Aug 3, 2023
  13. sidhujag referenced this in commit a56542615b on Aug 9, 2023
  14. bitcoin locked this on Aug 2, 2024

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-10-04 19:12 UTC

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