-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
The timeout setting is not honored when a transaction is active (with example) #124510
Comments
See https://www.sqlite.org/lang_transaction.html#read_transactions_versus_write_transactions
This looks like something expected on sqlite side, the provided script does exactly that and it breaks in this very moment of upgrade to write transaction
if you revmoe this part of code:
it does wait 10s before giving if you change "BEGIN" to "BEGIN IMMEDIATE", it also does wait 10s. Hope that helps. In any case, if this answers your question feel free to close this issue. |
Yes, I agree with Rafał; this is expected behaviour according to the SQLite docs. Closing as not-a-bug. Thanks for the report! |
Bug report
Bug description:
The timeout argument to sqlite3.connect is not honored and a "sqlite3.OperationalError: database is locked" is triggered immediately if this script is invoked a second time while the first is still running (sleeping). This only happens when a
transaction is active - if the BEGIN statement is removed the bug is not triggered.
Expected behavior: the script should wait for up to 10 seconds for the first invocation to finish before giving up
Actual behavior: the script immediately crashes with "sqlite3.OperationalError: database is locked"
Python version: 3.11.2 (Debian: python3.11-minimal 3.11.2-6+deb12u3, libpython3.11-stdlib:amd64 3.11.2-6+deb12u3)
SQLite version: 3.40.1 (Debian: sqlite3 3.40.1-2)
OS: Debian GNU/Linux 12.7
Kernel: Linux 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.94-1 (2024-06-21) x86_64 GNU/Linux
CPython versions tested on:
3.11
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: