Problem
Sentry Issue: NUXEO-DRIVE-538
[OS] Unable to restore C:\Users\USER\.nuxeo-drive\ndrive_ENGINE_UID.db OperationalError: disk I/O error File "nxdrive\engine\dao\sqlite.py", line 187, in __init__ File "nxdrive\engine\dao\utils.py", line 70, in fix_db File "nxdrive\engine\dao\utils.py", line 21, in is_healthy PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\USER\\.nuxeo-drive\\ndrive_ENGINE_UID.db' File "nxdrive\engine\dao\sqlite.py", line 244, in restore_backup File "nxdrive\engine\dao\utils.py", line 132, in restore_backup File "pathlib.py", line 1343, in unlink
Analysis
A database cannot be restored when is_healthy() failed just before. Actually, the connection to the database is not automatically closed when an exception is raised during the operation, even with the use of the context manager.
As the documentation states:
Connection object used as context manager only commits or rollbacks transactions, so the connection object should be closed manually.
Fix
Ensure to close to close the connection on any error.
- is related to
-
NXDRIVE-605 Handle corrupted SQLite database
- Resolved
- Is referenced in