Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Aug 2, 2023

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

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

From sqlite3 Python module docs:

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

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: ...
```
@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 2, 2023

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.

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 703b758

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).

@maflcko
Copy link
Member

maflcko commented Aug 3, 2023

lgtm ACK 703b758

@maflcko
Copy link
Member

maflcko commented Aug 3, 2023

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

@hebasto
Copy link
Member Author

hebasto commented Aug 3, 2023

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:

- python test\functional\test_runner.py --nocleanup --ci --quiet --combinedlogslen=99999999 --jobs=6 --timeout-factor=8 --extended --exclude feature_dbcrash

@fanquake fanquake merged commit 532bd1f into bitcoin:master Aug 3, 2023
@hebasto hebasto deleted the 230802-sqlite branch August 3, 2023 11:56
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 9, 2023
703b758 qa: Close SQLite connection properly (Hennadii Stepanov)

Pull request description:

  This PR is a follow-up for bitcoin#26462 that introduced a bug on Windows:
  ```
  >test\functional\wallet_descriptor.py
  ...
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
  ...
  ```

  From `sqlite3` Python module [docs](https://docs.python.org/3/library/sqlite3.html#how-to-use-the-connection-context-manager):
  > `Connection` object used as context manager only commits or rollbacks transactions, so the connection object should be closed manually.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 703b758
  theStack:
    utACK 703b758

Tree-SHA512: 35b1403507be06d1fc04e7e07ff56af5bcfe5013024671f0c1d9f3c41aacc4c777bcc6376ce82d720394e27450415d50ff5d5834ed388ec3f21503f86f1a42a5
@bitcoin bitcoin locked and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants