Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
import{DatabaseSync}from'node:sqlite';constdb=newDatabaseSync(':memory:');db.function('close_database',()=>{console.log('callback: closing database');db.close();console.log('callback: database closed');});console.log('before query');db.prepare('SELECT close_database()').get();console.log('after query');How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
close() should reject or defer finalization while statement execution depth is non-zero; db.deserialize() should apply the same protection.
What do you see instead?
before querycallback: closing databasecallback: database closedSegmentation fault
db.close() finalizes the prepared statement while that same statement is executing inside sqlite3_step(), and the process subsequently crashes.
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?
close()should reject or defer finalization while statement execution depth is non-zero;db.deserialize()should apply the same protection.What do you see instead?
db.close()finalizes the prepared statement while that same statement is executing insidesqlite3_step(), and the process subsequently crashes.Additional information
No response