Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
import { DatabaseSync } from 'node:sqlite';
const method = process.argv[2] ?? 'changeset';
const db = new DatabaseSync(':memory:');
db.exec('CREATE TABLE data (id INTEGER PRIMARY KEY)');
const session = db.createSession();
db.close();
db.open();
console.log(`calling session.${method}()`);
session[method]();
console.log('returned');
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Closing the database should invalidate associated session wrappers; after reopening, either method should throw an error such as Error: session is not open.
What do you see instead?
$ ../node/node repro.js changeset
calling session.changeset()
[1] 65858 segmentation fault ../node/node repro.js changeset
$ ../node/node repro.js close
calling session.close()
[1] 66266 segmentation fault ../node/node repro.js close
Both methods terminate the process because the session wrapper retains a stale native handle after db.close().
Additional information
No response
Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Closing the database should invalidate associated session wrappers; after reopening, either method should throw an error such as
Error: session is not open.What do you see instead?
$ ../node/node repro.js changeset calling session.changeset() [1] 65858 segmentation fault ../node/node repro.js changeset$ ../node/node repro.js close calling session.close() [1] 66266 segmentation fault ../node/node repro.js closeBoth methods terminate the process because the session wrapper retains a stale native handle after
db.close().Additional information
No response