You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagnostics_channel: Channel::binding_data_ dangles after environment cleanup, crashing node:sqlite at exit #65858
Channel holds its BindingData as a raw pointer that is never cleared, so any native holder that outlives environment cleanup reads a destroyed object. Here's a replication case using node:sqlite:
constdc=require('node:diagnostics_channel');const{ DatabaseSync }=require('node:sqlite');dc.subscribe('sqlite.db.query',()=>{});constdb=newDatabaseSync(':memory:');db.exec('CREATE TABLE t(x)');constins=db.prepare('INSERT INTO t VALUES (?)');for(leti=0;i<200;i++)ins.run(i);// Start iterating and abandon it: the statement stays mid-step, so the// finalize that happens at teardown fires SQLite's profile callback.constit=db.prepare('SELECT * FROM t').iterate();it.next();globalThis.keepAlive={ db, it };console.log('reached end of script');
How often does it reproduce? Is there a required condition?
Three conditions are required (all included in the example above):
A subscriber on sqlite.db.query, so the SQLite profile hook is installed.
A statement left mid-step at exit, so that the finalize during teardown has a started statement to profile.
No explicit close(), so the statement is finalized by the destructor chain after Environment::RunCleanup() rather than before it.
What is the expected behavior? Why is that the expected behavior?
Exiting a process that used node:sqlite with a sqlite.db.query subscriber
shouldn't crash.
Activity
diagnostics_channel: fix dangling binding pointer
diagnostics_channel,sqlite: fix dangling binding pointer
diagnostics_channel: fix dangling binding pointer
diagnostics_channel: fix dangling binding pointer
diagnostics_channel: fix dangling binding pointer