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

SQLite3.OperationalError: database is locked #13

Open
alphafox02 opened this issue Feb 5, 2023 · 1 comment
Open

SQLite3.OperationalError: database is locked #13

alphafox02 opened this issue Feb 5, 2023 · 1 comment

Comments

@alphafox02
Copy link

alphafox02 commented Feb 5, 2023

No issues running CYT short term, but if ran long enough I observe the following happening with various functions it performs.

cursorObj.execute(“SELECT…..)
sqlite3.OperationalError: database is locked

Recent encounter is line 104, sql_fetch_past_5

I wrapped one of the functions with a try/except block and while True it tries to select, if successful it breaks out but if not it sleeps for 1 second. I don’t know if that’s the best approach and even if so I guess I’d have to apply it to every function.

Better suggestions or thoughts?

@gcv-javier
Copy link

Hi Alpha,

If you take a look into the "map" branch the SQL exceptions are captured in chasing_your_tail.py, and to avoid the database to be blocked the cursorObj is closed.

There are also some prints out to see more details about the exception details, in case a new exception happens.

If you want to try the map branch take a look at the pdf, because you will need a GPS antenna so the tails are printed in a map.

Because I was developing the map feature I also fixed the issues I found on the way.

Best regards,
Javier

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