Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database is locked when performing auto cleanup #4971

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jojo-1000
Copy link
Contributor

Closes #4631, closes #3635

When a backup with --auto-cleanup detects unknown files, a repair is triggered while the database connection is still open. Because repair creates its own database connection, this causes an error The process cannot access the file because it is being used by another process (even though it is the same process).

Steps to reproduce error:

  • Create a backup with some files and enable --auto-cleanup
  • Run the backup
  • To trigger auto-cleanup (repair):
    On the destination, duplicate a dblock file and change a few digits in the name
  • To trigger auto-cleanup (recreate):
    Delete the local database of the backup (using UI works)
  • The live log shows Backend verification failed, attempting automatic cleanup

Current behavior:

  • error: database is locked database is locked in live log
  • Backup fails with error The process cannot access the file because it is being used by another process
  • (For recreate): Any subsequent manual repair or recreate calls fail with the same error, until duplicati is restarted

New behavior:

  • Auto cleanup deletes the extra files/recreates the database
  • Backup succeeds with warning Backend verification failed, attempting automatic cleanup and more warnings about the missing/extra files

Close the database connection before running the repair operation and reopen it after. This is necessary because repair tries to create another connection and a database recreate might be triggered, which needs to move the database.
Suppress the error message that a repair is required, as that is done automatically.
@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/error-uploading-file/16688/3

@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/failed-to-read-local-db-duplicati-blocks-itself-access-to-it/16806/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database is locked when performing auto-cleanup Cannot Access File
2 participants