fix(wa-sqlite): terminate shared clients on database drop - #209
Open
marcus-pousette wants to merge 1 commit into
Open
fix(wa-sqlite): terminate shared clients on database drop#209marcus-pousette wants to merge 1 commit into
marcus-pousette wants to merge 1 commit into
Conversation
This was referenced Jul 12, 2026
marcus-pousette
force-pushed
the
fix/wa-sqlite-shared-worker-lifecycle
branch
from
July 13, 2026 14:31
ea62da3 to
dc51f82
Compare
This was referenced Jul 13, 2026
marcus-pousette
force-pushed
the
stack/wa-sqlite-materialized-fastpath
branch
from
July 14, 2026 20:37
d61997c to
f8be4fe
Compare
marcus-pousette
force-pushed
the
fix/wa-sqlite-shared-worker-lifecycle
branch
from
July 14, 2026 20:43
dc51f82 to
16ca00c
Compare
marcus-pousette
force-pushed
the
fix/wa-sqlite-shared-worker-lifecycle
branch
from
July 15, 2026 06:45
16ca00c to
fe1ffde
Compare
marcus-pousette
force-pushed
the
stack/wa-sqlite-materialized-fastpath
branch
2 times, most recently
from
July 15, 2026 07:16
5b6831f to
6a918bb
Compare
marcus-pousette
force-pushed
the
fix/wa-sqlite-shared-worker-lifecycle
branch
from
July 15, 2026 07:16
fe1ffde to
102b54a
Compare
marcus-pousette
force-pushed
the
fix/wa-sqlite-shared-worker-lifecycle
branch
from
July 15, 2026 08:01
102b54a to
b319854
Compare
marcus-pousette
force-pushed
the
stack/wa-sqlite-materialized-fastpath
branch
from
July 15, 2026 08:01
6a918bb to
391a65f
Compare
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.
Summary
Every tab connected to a SharedWorker database uses the same SQLite session. When one client explicitly calls
drop(), that database is deleted and the shared session becomes invalid for every connected client—not only the caller.This PR makes
drop()a terminal session boundary. The worker notifies peer clients, rejects their pending calls with a clear dropped-database error, detaches their ports, and allows a later client to open a clean replacement session. It also prunes ports after observable message/send failures and resets the database once the final client closes.Scope
This handles explicit
drop()and failures the SharedWorker can observe. It does not treat refresh or page unload as a drop, and it cannot reliably detect every abrupt tab or process termination. Adding heartbeat/lease-based liveness would be separate work.Stack
Depends on #163. After merging this PR with a merge commit, retarget #165 to
main.