-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
[v18.x] src: per-realm binding data #47174
Conversation
Review requested:
|
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.
RSLGTM
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
@legendecas are you able to restart the ASan test to confirm it passes before landing in v18? Thanks! |
Binding data is inherited from BaseObject and created in a specific realm. They need to be tracked on a per-realm basis so that they can be released properly when a realm is disposed. PR-URL: nodejs#46556 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> # Conflicts: # src/dataqueue/queue.cc
4740107
to
125af5c
Compare
Seems like I can not restart the ASan action either. I've rebased the branch on the tip of v18.x-staging. |
Landed in 0b92035 |
Binding data is inherited from BaseObject and created in a specific realm. They need to be tracked on a per-realm basis so that they can be released properly when a realm is disposed. PR-URL: #46556 Backport-PR-URL: #47174 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> # Conflicts: # src/dataqueue/queue.cc
@@ -539,7 +539,8 @@ void Environment::AssignToContext(Local<v8::Context> context, | |||
context->SetAlignedPointerInEmbedderData(ContextEmbedderIndex::kRealm, realm); | |||
// Used to retrieve bindings | |||
context->SetAlignedPointerInEmbedderData( | |||
ContextEmbedderIndex::kBindingListIndex, &(this->bindings_)); | |||
ContextEmbedderIndex::kBindingDataStoreIndex, | |||
realm->binding_data_store()); |
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 function is called from node_contextify.cc
like this:
env->AssignToContext(v8_context, nullptr, info);
This appears to get an invalid value in that flow. What's the expected behavior? Should the embedder data be nullptr
when realm
is nullptr
?
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.
I haven't fully looked into how this slot is used but I suspect the fix is:
// Used to retrieve bindings
context->SetAlignedPointerInEmbedderData(
ContextEmbedderIndex::kBindingDataStoreIndex,
realm != nullptr ? realm->binding_data_store() : nullptr);
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.
Sending #48802 in case that is the fix.
Binding data is inherited from BaseObject and created in a specific realm. They need to be tracked on a per-realm basis so that they can be released properly when a realm is disposed.
PR-URL: #46556
Reviewed-By: Joyee Cheung joyeec9h3@gmail.com
Reviewed-By: Colin Ihrig cjihrig@gmail.com
Reviewed-By: Matteo Collina matteo.collina@gmail.com