Repository navigation
Let the store connection release the streams its scope outlives - #3694
Merged
Merged
Conversation
Every heartbeat pass logged "Exception ignored while closing generator TypedRow.iterate ... Cannot operate on a closed database": a caller dropped a half-read typed stream, the store scope closed its connection, and the collector later ran the stream's finally, closing a cursor on a dead database. StoreContention, the one place store connections are opened, now opens a LendingConnection. It owns every cursor it lends and retires them before it closes, so a stream released afterwards has nothing left to release. Callers no longer need closing() around each stream to cover for the scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XbFMSoWgC3ZwKzjT4SwMDu
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
debt-src at 10b5bf1, every finding: |
trissim
enabled auto-merge
October 30, 2026 12:40
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.
Tracebacks per heartbeat pass: 1+ -> 0. The installed connector logs
Exception ignored while closing generator TypedRow.iterate ... typed_table.py:610 cursor.close() ... Cannot operate on a closed databaseevery 2-3 min.Why it existed
TypedRow.iterate(typed_table.py:603) closes its cursor infinally. A caller that drops a half-read stream (e.g.next(FailedTurnEvidence.stream(...))at goal_attempts.py:149) leaves thatfinallyto the collector, which runs after the store scope has already closed the connection. #3670 patched two callers withclosing(). That is a several-places fix: every new streaming caller would need it again. The fact "a query lives no longer than its connection" belongs to the connection.Change
store_files.py:StoreContention.reader/writer, the one place store connections are opened, passfactory=LendingConnection.LendingConnection(sqlite3.Connection)lendsLentCursors (throughcursor/execute/executemany/executescript) and retires them inclose()before closing itself.RetiredCursor(LentCursor): a retire swaps the class, and itsclose()has nothing left to release. No flag, no branch.test_store_connection_releases_streams_its_scope_outlives: a half-read stream outlives itsclosing()scope;gc.collect();sys.unraisablehookreceives nothing.Proof
unraisable: [ProgrammingError('Cannot operate on a closed database.')]. On this head:unraisable: [].tests/round2/test_typed_table.py+test_commander_forks.py::test_two_commanders_cannot_assign_the_same_unit_concurrently: 22 passed.Follow-on: #3670's
closing()commit (todos.py:6036, goal_attempts.py:149) becomes redundant and should be dropped from its carrier.🤖 Generated with Claude Code
https://claude.ai/code/session_01XbFMSoWgC3ZwKzjT4SwMDu