-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
async_hooks: enable AsyncLocalStorage once constructed #58029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes the leak behavior when using `enterWith` when no `AsyncLocalStorage`s were enabled inside a promise.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58029 +/- ##
==========================================
- Coverage 90.27% 90.27% -0.01%
==========================================
Files 630 630
Lines 186159 186161 +2
Branches 36473 36476 +3
==========================================
- Hits 168053 168048 -5
+ Misses 10976 10974 -2
- Partials 7130 7139 +9
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Does this only reproduce with the async_hooks version of AsyncLocalStorage? |
Yes. |
Landed in 8e7ae60 |
I'm adding a backing-for-lts comment as we should evaluate if it has real-life breakage before backporting |
This fixes the leak behavior when using
enterWith
when noAsyncLocalStorage
s were enabled inside a promise. With thischange, the following code snippets will behave the same:
On the performance side, given that an
AsyncLocalStorage
is constructed, we should assume that it will be used and prefer correctness over lazy-initialization optimization.Fixes: #53037
Refs: #58019
/cc @nodejs/diagnostics