Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
import { DatabaseSync, constants } from 'node:sqlite';
const db = new DatabaseSync(':memory:');
db.exec('CREATE TABLE t(id INTEGER PRIMARY KEY, value TEXT)');
const session = db.createSession({ table: 't' });
db.exec("INSERT INTO t VALUES (1, 'a'), (2, 'b'), (3, 'c')");
db.setAuthorizer(() => {
session.close();
return constants.SQLITE_OK;
});
try {
console.log(session.changeset().length);
} catch (err) {
console.log(`${err.name}: ${err.message}`);
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should fail without freeing the active native session out from under the in-progress operation.
What do you see instead?
Error: session is not open
Calling changeset() enters SQLite session changeset generation, which runs SQL internally and invokes the authorizer. The authorizer closes the same Session reentrantly, so native changeset generation continues after the underlying session has been deleted.
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?
It should fail without freeing the active native session out from under the in-progress operation.
What do you see instead?
Error: session is not openCalling
changeset()enters SQLite session changeset generation, which runs SQL internally and invokes the authorizer. The authorizer closes the sameSessionreentrantly, so native changeset generation continues after the underlying session has been deleted.Additional information
No response