diagnostics_channel: replace using with try-finally - #64251
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
|
Thanks for the thorough review, @Renegade334 and @anonrig!
|
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
|
Thanks for the LGTM! I ran make |
d7d9082 to
0be0ec6
Compare
Qard
left a comment
There was a problem hiding this comment.
One minor nit but otherwise LGTM.
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
0be0ec6 to
50b7999
Compare
jasnell
left a comment
There was a problem hiding this comment.
I'm -1 on moving away from using. It's stage 4 at this point. I'd rather we forbid the option that allows it to be turned off than not use it.
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64251 +/- ##
==========================================
- Coverage 92.02% 90.14% -1.89%
==========================================
Files 381 769 +388
Lines 168990 261683 +92693
Branches 25901 49680 +23779
==========================================
+ Hits 155521 235889 +80368
- Misses 13179 16803 +3624
- Partials 290 8991 +8701
🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
|
Hey @Renegade334. I just pushed a minor fixup to resolve a missing newline linter error, which invalidated the CI run you just started. Could you re-trigger it when you get a chance? |
|
Landed in b125121 |
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