domain: port to AsyncLocalStorage#61095
Open
mcollina wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61095 +/- ##
==========================================
- Coverage 90.29% 90.29% -0.01%
==========================================
Files 730 730
Lines 234782 234899 +117
Branches 43953 43962 +9
==========================================
+ Hits 211993 212095 +102
- Misses 14501 14533 +32
+ Partials 8288 8271 -17
🚀 New features to boost your workflow:
|
RafaelGSS
reviewed
Dec 17, 2025
anonrig
approved these changes
Dec 18, 2025
b307f20 to
1d24947
Compare
RafaelGSS
approved these changes
Dec 18, 2025
Collaborator
Flarna
reviewed
Dec 19, 2025
Member
Flarna
left a comment
There was a problem hiding this comment.
I have to admit that I do not fully understand domains so take my review with a grain of salt.
ronag
approved these changes
Jan 11, 2026
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Member
|
@mcollina seems this requires a rebase |
AugustinMauroy
approved these changes
Mar 29, 2026
| The `domain` property on async resources and `MakeCallback` has been removed. | ||
| The domain module now uses `AsyncLocalStorage` for context propagation instead | ||
| of `async_hooks`. Accessing the `domain` property on `AsyncResource` will throw | ||
| an error. Use `AsyncLocalStorage` instead for context propagation. |
Member
There was a problem hiding this comment.
Matteo is it possible to have a before/after example of this depreciation?
Member
Author
There was a problem hiding this comment.
I'm not sure how, the property is not there anymore. If you used it, your code would not work anymore.
23abf1e to
6adae72
Compare
6adae72 to
5b03c94
Compare
5b03c94 to
0d3b40f
Compare
Port the domain module from createHook (async_hooks) to AsyncLocalStorage using the AsyncContextFrame-based implementation. Key changes: - Use AsyncLocalStorage for domain context propagation instead of async_hooks.createHook() - Lazy initialization that triggers AsyncContextFrame prototype swap on first domain use - Use enterWith instead of ALS.run() so domain context is NOT automatically restored on exception - this matches the original domain.run() behavior where exit() only runs on success - Add ERR_ASYNC_RESOURCE_DOMAIN_REMOVED error for AsyncResource.domain - Update DEP0097 to End-of-Life status - Remove tests that relied on the removed MakeCallback domain property The domain module now uses the AsyncContextFrame version of AsyncLocalStorage directly for proper context propagation across async boundaries. Signed-off-by: Matteo Collina <hello@matteocollina.com>
0d3b40f to
dfb45e5
Compare
Member
Author
|
@nodejs/tsc PTAL |
ShogunPanda
approved these changes
May 28, 2026
Contributor
Failed to start CI- Validating Jenkins credentials ✔ Jenkins credentials valid - Querying data for job/node-test-pull-request/70926/ [SyntaxError: Unexpected token '<', ..." https://github.com/nodejs/node/actions/runs/26565145418 |
Contributor
Failed to start CI- Validating Jenkins credentials ✔ Jenkins credentials valid - Querying data for job/node-test-pull-request/70926/ [SyntaxError: Unexpected token '<', ..." https://github.com/nodejs/node/actions/runs/26585062544 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port the domain module from createHook (async_hooks) to AsyncLocalStorage using the AsyncContextFrame-based implementation.
Key changes:
The domain module now uses the AsyncContextFrame version of AsyncLocalStorage directly for proper context propagation across async boundaries.