Repository navigation
Node 16.2 regression, crashing with node::InternalCallbackScope::Close() error #38815
Description
Activity
- changed the title
[-]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed`[/-][+]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close(): Assertion (env_->execution_async_id()) == (0)' failed`[/+]on May 26, 2021 - changed the title
[-]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close(): Assertion (env_->execution_async_id()) == (0)' failed`[/-][+]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close(): Assertion (env_->execution_async_id()) == (0) failed`[/+]on May 26, 2021 - changed the title
[-]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close(): Assertion (env_->execution_async_id()) == (0) failed`[/-][+]Node 16.2 regression, crashing with `node::InternalCallbackScope::Close()` error[/+]on May 26, 2021 - addedasync_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.
on May 26, 2021 A repro that doesn't depend on any npm package would be very helpful.
Reacted by Jon LauridsenReproduciable in
16.2.0but not inmaster. It may have been fixed. I'd retest it when16.3.0is released.Met same issue. Another demo to help reproduce at #38814
A repro that doesn't depend on any npm package would be very helpful.
Just to say I did try to remove the two dependencies, but I couldn't find a way to still trigger the error. I suspect there is a way if I better understood the underlying trigger, but given my current understanding I couldn't find it. Sorry, I do appreciate external dependencies are not the responsibility of this project, I hope someone can see the pattern well enough to narrow down the trigger.
This should be fixed by #38912 which will be in the next release, likely 16.3.1 or 16.4.0. If you have any further issues, let me know!
Reacted by Hongbo Miao and Fini Alring- added a commit that references this issue
on Jun 11, 2021 - added a commit that references this issue
on Aug 1, 2021 - added a commit that references this issue
on Aug 3, 2021 - added a commit that references this issue
on Aug 12, 2021 - added a commit that references this issue
on Aug 31, 2021 - added a commit that references this issue
on May 22, 2026
Upgrading from Node 16.1 to 16.2 causes Node to crash, and I don't know how to debug the problem further. This is related to promises and maybe async_hooks or cls-hooked library, but I'm not knowledgeable enough to understand how or why it actually happens.
What steps will reproduce the bug?
I have cooked up a minimal repo here: https://github.com/heap-dk/node-16.2-crash/
The problem manifests itself somehow in relation to promises and async hooks... I think! The repo's readme shows the problem, the code is as minimal as I could make it to showcase the problem, and the commands to replicate the issue are simple. I hope that's good enough to be of interest to you.
The repo has dependencies on dd-trace and cls-hooked, but I don't think the problem is unique to those dependencies, rather I think it's related to their underlying use of async_hooks and somehow it results in a crash... 👀 But I'm guessing on those details so I very much hope someone with more knowledge about these systems can see the deeper pattern!
How often does it reproduce? Is there a required condition?
100% crash.
What is the expected behavior?
I didn't expect a Node patch bump to introduce a breaking behavior like this.
What do you see instead?
Additional information
To be honest I don't understand the finer points of this crash, but I'm creating this issue because my perception is that upgrading from Node 16.1 to 16.2 introduces this regression. I'm happy to add more context or try different solutions if that will be helpful.
And I want to take a moment to thank the maintainers of Node for making these releases available, crashing or not I'm grateful for your hard work.