src: convert context_frame field in AsyncWrap to internal field#62103
Open
addaleax wants to merge 3 commits intonodejs:mainfrom
Open
src: convert context_frame field in AsyncWrap to internal field#62103addaleax wants to merge 3 commits intonodejs:mainfrom
addaleax wants to merge 3 commits intonodejs:mainfrom
Conversation
This helps ensure that we already set the correct number of internal fields when creating objects, even if the number of internal fields of e.g. AsyncWrap changes over time.
Using an internal field instead of a `v8::Global<>` removes an unnecessary memory leak footgun. This includes a test that demonstrates the issue, albeit using internal APIs. It's worth noting that if this PR is not accepted, we'd still be missing memory tracking for the `context_frame_` field, and we'd need to add it through our memory tracking API.
This was invaluable for debugging the previous change, so I'm suggesting we add it regardless of it being a debugging-only API.
Collaborator
|
Review requested:
|
Qard
approved these changes
Mar 4, 2026
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62103 +/- ##
=======================================
Coverage 89.64% 89.64%
=======================================
Files 676 676
Lines 206326 206343 +17
Branches 39528 39532 +4
=======================================
+ Hits 184960 184985 +25
- Misses 13476 13483 +7
+ Partials 7890 7875 -15
🚀 New features to boost your workflow:
|
Collaborator
Flarna
approved these changes
Mar 4, 2026
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.
Refs: #61995 (comment)
src: make AsyncWrap subclass internal field counts explicit
This helps ensure that we already set the correct number of
internal fields when creating objects, even if the number of
internal fields of e.g. AsyncWrap changes over time.
src: convert context_frame field in AsyncWrap to internal field
Using an internal field instead of a
v8::Global<>removesan unnecessary memory leak footgun.
This includes a test that demonstrates the issue, albeit
using internal APIs.
It's worth noting that if this PR is not accepted, we'd still
be missing memory tracking for the
context_frame_field,and we'd need to add it through our memory tracking API.
src: expose async context frame debugging helper to JS
This was invaluable for debugging the previous change,
so I'm suggesting we add it regardless of it being a
debugging-only API.