fix: don't leak a user-provided fs into the inner initdb instance - #1060
Open
AntonOfTheWoods wants to merge 1 commit into
Open
fix: don't leak a user-provided fs into the inner initdb instance#1060AntonOfTheWoods wants to merge 1 commit into
AntonOfTheWoods wants to merge 1 commit into
Conversation
AntonOfTheWoods
force-pushed
the
fix/initdb-inner-instance-fs-leak
branch
from
July 19, 2026 00:06
77a10d4 to
2851470
Compare
Creating a fresh database boots a second, inner PGlite instance to run
initdb, built from a shallow copy of the caller's options with dataDir,
extensions, and loadDataDir cleared — but not fs. A user-provided
filesystem instance therefore had its init() called a second time by the
inner instance, colliding with resources the outer instance already
holds. For OPFS-based VFSs (whose sync access handles are exclusive per
file) this makes any fresh PGlite.create({ fs }) fail with
NoModificationAllowedError; the dataDir-scheme paths never hit it
because the inner instance falls through to a scratch memoryfs.
Clear fs alongside the other per-store options so the inner initdb
instance always runs on its own scratch filesystem.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AntonOfTheWoods
force-pushed
the
fix/initdb-inner-instance-fs-leak
branch
from
July 19, 2026 00:22
2851470 to
9f4baa8
Compare
Contributor
Author
|
CI note on the two red runs, for whoever reviews:
Neither failure intersects this diff: it's TypeScript-only ( |
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.
Creating a fresh database boots a second, inner PGlite instance to run initdb, built from a shallow copy of the caller's options with dataDir, extensions, and loadDataDir cleared — but not fs. A user-provided filesystem instance therefore had its init() called a second time by the inner instance, colliding with resources the outer instance already holds. For OPFS-based VFSs (whose sync access handles are exclusive per file) this makes any fresh PGlite.create({ fs }) fail with NoModificationAllowedError; the dataDir-scheme paths never hit it because the inner instance falls through to a scratch memoryfs.
Clear fs alongside the other per-store options so the inner initdb instance always runs on its own scratch filesystem.