Repository navigation
Open the case connection with no statement cache on Python 3.11 and later - #256
Merged
Merged
Conversation
…ater Every thread shares a case's one connection and reads do not take the lock. From Python 3.12 the sqlite3 module can hand two threads that run the same statement text the same cached prepared statement, so one read got another read's row, no row, or an error. With four threads asking for different rows, 276 to 388 of 1,600 get_file calls and 60 to 85 of 600 /api/file requests came back wrong on Python 3.12 and 3.14. The connection is now opened with cached_statements=0 on Python 3.11 and later, so every execute() prepares its own statement. Python 3.10 keeps the module default: it does not have the defect, and its own cache broke under threads when asked for 0. tests/test_shared_connection_reads.py runs the readers in a child process under a timeout and fails on the code before this change on Python 3.12 and 3.14. The measurements and the CPython lines are in .claude/rules/gleapp-cross-platform.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opens the case connection with no statement cache on Python 3.11 and later.
Co-Authored-By: Claude Opus 5.5 [email protected]