Version
main
Platform
Subsystem
diagnostics_channel
What steps will reproduce the bug?
import{channel,subscribe}from'node:diagnostics_channel';import{DatabaseSync}from'node:sqlite';constch=channel('sqlite.db.query');constdb=newDatabaseSync(':memory:');console.log('before:',ch.hasSubscribers);try{subscribe('sqlite.db.query',null);}catch(error){console.log('caught:',error.code);}console.log('after:',ch.hasSubscribers);// This query enters the unnecessarily installed native trace callback.db.exec('SELECT 1');db.close();How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The invalid callback should be rejected before the channel becomes active or native modules are notified, and hasSubscribers should remain false.
What do you see instead?
before: falsecaught: ERR_INVALID_ARG_TYPEafter: true
A rejected subscription changes hasSubscribers from false to true even though no callback was installed.
Additional information
No response
Version
main
Platform
Subsystem
diagnostics_channel
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?
The invalid callback should be rejected before the channel becomes active or native modules are notified, and
hasSubscribersshould remainfalse.What do you see instead?
A rejected subscription changes
hasSubscribersfromfalsetotrueeven though no callback was installed.Additional information
No response