-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Begin AsyncWrap maintenance #3139
Conversation
Several provider ids have been removed that are no longer in use. Others have been updated to match their class constructors. Add test to ensure all internally listed providers are used.
31a59b8
to
d415be9
Compare
If the constructor can't assign a class id then the heap snapshot will not be able to report the object. So ensure that all AsyncWrap instances use a FunctionTemplate instance with an internal field count >= 1.
d415be9
to
66b2890
Compare
To be clear, async wrap will still work during this time, correct? Otherwise one PR may be more appropriate? |
@Fishrock123 Each PR will have a small set of fixes. No PR will prevent AsyncWrap from working at least as well as it does today. This PR fixed outdated providers list and not all instances being reported in the heap snapshot. |
Sounds good to me then. I definitely can't actually review this haha. |
// Shift provider value over to prevent id collision. | ||
persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider); | ||
CHECK_NE(provider, PROVIDER_NONE); | ||
CHECK_GE(object->InternalFieldCount(), 1); |
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.
These two will throw errors. Doesn't it make it major change? If this is an internal function, do we really need this?
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.
This doesn't throw an error. It aborts. The first couldn't have happened anyway because of how the function signature works. It's there as a sanity check for future development. The latter should never have been happening as it would have caused issues when iterating the heap.
Can you please summarize what this PR does and why it is necessary? Edit:
Ah I see. I'll try to find what providers are. |
fn_t->SetClassName(FIXED_ONE_BYTE_STRING(isolate(), "InternalFieldObject")); | ||
v8::Local<v8::ObjectTemplate> obj_t = fn_t->InstanceTemplate(); | ||
obj_t->SetInternalFieldCount(1); | ||
set_generic_internal_field_template(obj_t); |
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.
Mild cognitive dissonance here, the _t
suffix makes it look like the variables are typedefs at a quick glance.
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.
Forgot that convention. Was using it as shorthand for template. Will change.
LGTM with some suggestions. |
LGTM, other than the comments from Ben. |
Several provider ids have been removed that are no longer in use. Others have been updated to match their class constructors. Add test to ensure all internally listed providers are used. PR-URL: #3139 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-by: Stephen Belanger <[email protected]>
If the constructor can't assign a class id then the heap snapshot will not be able to report the object. So ensure that all AsyncWrap instances use a FunctionTemplate instance with an internal field count >= 1. PR-URL: #3139 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-by: Stephen Belanger <[email protected]>
Landed with suggested changes in e52864b and 3f476ad. Should land on current stable before going LTS. |
Several provider ids have been removed that are no longer in use. Others have been updated to match their class constructors. Add test to ensure all internally listed providers are used. PR-URL: #3139 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-by: Stephen Belanger <[email protected]>
If the constructor can't assign a class id then the heap snapshot will not be able to report the object. So ensure that all AsyncWrap instances use a FunctionTemplate instance with an internal field count >= 1. PR-URL: #3139 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-by: Stephen Belanger <[email protected]>
landed in v4.x-staging in e561585...39b8730 |
This is long overdue maintenance on
AsyncWrap
. More PRs will follow, but segmenting to keep reviews simple.R=@bnoordhuis
R=@indutny
CI: https://ci.nodejs.org/job/node-test-pull-request/405/CI: https://ci.nodejs.org/job/node-test-pull-request/406/