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

"database is locked" eventually happens #49

Open
marado opened this issue Oct 5, 2022 · 1 comment
Open

"database is locked" eventually happens #49

marado opened this issue Oct 5, 2022 · 1 comment

Comments

@marado
Copy link
Contributor

marado commented Oct 5, 2022

If I leave botany running for too long (possibly while other users run it, or also leave it running), eventually a "database is locked" error invades the screen.

Sorry that it wasn't possibly to copy paste the full trace well (the output mangled with botany's usual output), but that I captured provides the relevant parts:

self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
File "/    self._target(*self._args, **self._kwargs) _bootstrap_inner
File "/home/repos/botany/botany.py", line 434, in autosave
self.update_garden_db(this_plant)
File "/home/repos/botany/botany.py", line 517, in update_garden_db
self.init_database()
File "/home/repos/botany/botany.py", line 491, in init_database
c.execute(init_table_string)
sqlite3.OperationalError: database is locked

I could provide a patch to catch the error on init_database's execute, but before that it probably makes sense to decide what to do in these cases: while ignoring the failure is probably alright on autosave calls (the next autosave deals with it; we can also create a counter of consecutive fails to make sure it is only a sporadic concurrency issue), it probably is not in other calls. Also, it make sense investigating the root cause of the issue - who/what is locking the database for so long?

@epilys
Copy link

epilys commented Apr 10, 2023

Some mitigations:

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

No branches or pull requests

2 participants