Minimal SvelteKit reproduction for a suspected prepared statement leak in
kysely-wasqlite-worker@1.2.1.
The page runs normal Kysely execute() queries through
WaSqliteWorkerDialect, then immediately calls db.destroy(). The dialect is
configured with preferOPFS: true and otherwise uses the package defaults.
pnpm install
pnpm devOpen the local Vite URL, open the browser console, and click
Run reproduction.
Or run the browser reproduction directly:
pnpm testdb.destroy() should close the SQLite worker cleanly.
In the failing case, db.destroy() rejects with:
unable to close due to unfinalized statements or unfinished backups
The browser console also logs each reproduction step with the
[worker-query-data-repro] prefix.
queryData manually calls next() on the sqlite.statements(...) async
iterator:
@subframe7536/sqlite-wasm documents that manual iterator users should call
return() if iteration is abandoned before completion:
https://github.com/subframe7536/sqlite-wasm/blob/master/src/types/api.ts#L529-L566