Uh oh!
There was an error while loading. Please reload this page.
diagnostics_channel: replace using with try-finally - #64251
diagnostics_channel: replace using with try-finally#64251ayush23chaudhary wants to merge 4 commits 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
548c1c1 to
1d66ae6CompareThanks 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 👍
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1d66ae6 to
6f2d7ccCompareayush23chaudhary
commented
Jul 3, 2026
|
Renegade334
commented
Jul 3, 2026
LGTM, but please run |
6f2d7cc to
d7d9082Compareayush23chaudhary
commented
Jul 3, 2026
Thanks for the LGTM! I ran make |
d7d9082 to
0be0ec6CompareUh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
0be0ec6 to
50b7999Comparenodejs-github-bot
commented
Jul 4, 2026
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.
Hi @jasnell, thanks for commenting Since @Renegade334, @anonrig, and @Qard previously reviewed and approved this try-finally refactor to resolve #64230, it seems like there is a difference in philosophy on how Node core should handle the --no-js-explicit-resource-management flag now that ERM is Stage 4. I am more than happy to pivot and take a different approach (like opening a PR to forbid the flag instead, if that is the preferred direction). I will pause my work here and let you all reach a consensus on the best path forward for the project. Just let me know what the final decision is, and I'll be happy to execute it. |
Qard
commented
Jul 5, 2026
I'm fine either way. There's not much use of ERM in core yet, only exposing as an API surface. In my opinion, needing to use the try/finally form is not much more than a minor annoyance. An argument could be made that no longer functioning with that flag should make the introduction of ERM use a semver-major. We could allow this change and then follow up with restoring ERM and calling it a semver-major. 🤔 |
jasnell
commented
Jul 5, 2026
Given that the flag is a v8 flag and we intentionally do not cover v8 flags with semver, I'd argue that it doesn't need to be a semver-major at all. |
Renegade334
commented
Jul 23, 2026
@jasnell would you be happy to apply #64231 (comment) here? |
nodejs-github-bot
commented
Jul 23, 2026
anonrig
left a comment
There was a problem hiding this comment.
I don't think we should do this. I agree with other comments.
Uh oh!
There was an error while loading. Please reload this page.
Renegade334
commented
Aug 4, 2026
Since we have two linked PRs in parallel, cross-posting from #64231 (comment):
@anonrig would this be something on which you would reconsider your block? |
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.
nodejs-github-bot
commented
Aug 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
Signed-off-by: Ayush Chaudhary <ayush23chaudhary@gmail.com>
ayush23chaudhary
commented
Sep 4, 2026
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? |
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