Skip to content

fix(nodejs): close() invalidates dependents so native DB is destroyed synchronously - #30

Merged
adsharma merged 1 commit into
mainfrom
fix/29-close-invalidates-dependents
Nov 20, 2026
Merged

adsharma merged 1 commit into
mainfrom
fix/29-close-invalidates-dependents

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Closes #29.

Port of reporter proposal.

NodeDatabase::Close now releases native connections/query results still holding the Database (DatabaseDependent registry), including wrappers already GC'd but not finalized, so ~Database() checkpoint cannot run later and rotate a new DB's WAL. Database.close() closes tracked connections first (WeakRef+FinalizationRegistry); open results report 'Query result is closed'.

Verified: deterministic repro now prints wal on disk:true + [a,b,c]; new subprocess-lock regression test passes.

@adsharma
adsharma force-pushed the fix/29-close-invalidates-dependents branch from ae433b6 to 7ce110f Compare November 18, 2026 23:23
… synchronously

Port of reporter proposal for #29.

NodeDatabase::Close now releases native connections/query results
still holding the Database (DatabaseDependent registry), including
wrappers already GC'd but not finalized, so ~Database() checkpoint
cannot run later and rotate a new DB's WAL. Database.close() closes
tracked connections first (WeakRef+FinalizationRegistry); open results
report 'Query result is closed'.

Adds regression test using openDatabaseOnSubprocess lock check.
@adsharma
adsharma force-pushed the fix/29-close-invalidates-dependents branch from e2ad146 to 4d7a31c Compare November 20, 2026 00:52
@adsharma
adsharma merged commit f23c7de into main Nov 20, 2026
3 of 4 checks passed
@adsharma
adsharma deleted the fix/29-close-invalidates-dependents branch November 20, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Database.close() leaves the native database open while a QueryResult is alive, and its delayed close breaks a new Database on the same path

1 participant