diagnostics_channel: replace using with try-finally#64251
diagnostics_channel: replace using with try-finally#64251ayush23chaudhary wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the experimental using syntax from lib/diagnostics_channel.js, replacing it with equivalent try...finally disposal to avoid crashes when Node is run with --no-js-explicit-resource-management.
Changes:
- Replaced
usingstatements with explicittry...finallyblocks that invoke[SymbolDispose](). - Updated scope handling in
ActiveChannel,BoundedChannel, andTracingChannelpaths to ensure disposal occurs reliably without relying on flagged syntax.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
548c1c1 to
1d66ae6
Compare
Renegade334
left a comment
There was a problem hiding this comment.
Thanks for your changes! Some more comments 👍
1d66ae6 to
6f2d7cc
Compare
|
|
LGTM, but please run |
6f2d7cc to
d7d9082
Compare
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
d7d9082 to
0be0ec6
Compare

Fixes: #64230
Description
This PR replaces instances of the experimental
usingsyntax withtry...finallyblocks insidelib/diagnostics_channel.js.Since Explicit Resource Management is still a flagged feature in V8, encountering
usingin core causes a segfault when running Node with the--no-js-explicit-resource-managementflag. This refactor maintains the exact same resource cleanup semantics by manually calling[SymbolDispose]()in afinallyblock, avoiding the flagged syntax entirely.Example of Refactor
Before:
After