Repository navigation
fix(sqlite): keep verified foreign-file pins until reader close - #4732
Closed
ScriptedAlchemy wants to merge 1 commit into
Closed
ScriptedAlchemy wants to merge 1 commit into
ScriptedAlchemy wants to merge 1 commit into
Conversation
Keep verified foreign SQLite readers together with their inode pins when moving into the shared host reader. Drop the SQLite connection before its raw pin, and verify that cloned host handles retain both descriptors until the final handle is released on Linux. Refs #4513; complements #4720 without addressing the writer pin lifecycle.
|
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
This was referenced Nov 3, 2026
Owner
Author
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.
Root cause
Refs #4513; this is a separate lock-lifetime defect from #4720.
open_verified_immutable_readerbinds a SQLite connection to a pinned database inode, but Cursor's composer reader immediately calledVerifiedReader::into_parts(). That discarded the raw file pin while the extracted SQLite connection stayed live insideSqliteReadConn. On Unix, closing any file descriptor for a SQLite database inode may release the process's advisory record locks, including locks owned by another connection. The verified reader's ordinary field drop order also released the pin before closing its own SQLite connection.Change
into_partsso the original early-drop route cannot recur.No change to SQLite configuration, database contents, admission checks, authorization, receipts, or filesystem cleanup.
Validation
VerifiedReader::into_partscaller; the published commit changes those three files only.BEGIN IMMEDIATEbefore an unrelated raw database descriptor was opened/closed, then was admitted after the close. This establishes the OS mechanism, not a pass for the Rust regression.//crates/tracedecay-sessions:unit_test(including the new Linux descriptor-lifetime regression),//crates/tracedecay-rusqlite-runtime:unit_test, and the Cursor composer integration journeys on the exact PR head.Remaining scope
This fixes the verified foreign reader's premature pin drop. #4720 independently addresses opening/closing a temporary raw descriptor during pathname identity verification. Other shared writer/reader pin clone and explicit lost-file release lifetimes require separate auditing; this PR does not demonstrate that the reported live
sessions.db+ externalsqlite3read workflow is corruption-safe. Keep #4513 open pending actual SQLite-backed stress/integrity coverage, especially on macOS. The existing PR repair/merge automation owns CI follow-up and authorized merges.