-
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
Late enabling of async_hooks after promise creation causes process abort #13237
Comments
Could we create a new |
Ack, I think this is a better solution, at least as long as we don’t have metrics on how expensive enabling a |
Sounds good. But we will have to make sure the |
Done in #13242 :) |
Assign a `PromiseWrap` instance to Promises that do not have one yet when the PromiseHook is being called. Fixes: nodejs#13237
Assign a `PromiseWrap` instance to Promises that do not have one yet when the PromiseHook is being called. Fixes: #13237 PR-URL: #13242 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: Matthew Loring <[email protected]>
Having thought some more about #13177, I don't think there is much difference between that approach and checking if async_hooks is enabled by:
But the above solution is more consistent when
.disable()
is called after.enable()
. Perhaps, more importantly, it highlights an issue where the promise is created just before the hooks are setup. In which case the node process will currently abort because ofCHECK_NE(wrap, nullptr);
.causes the following error:
I don't think there is a good solution to this problem. But I would like to another opinion on that.
Otherwise, we will just have to check for the
env->promise_wrap()
property and not emit before, after and destroy in this case. This is a difference behavior than that for all other*Wrap
types, which is why it is not a good solution./cc @addaleax @matthewloring
The text was updated successfully, but these errors were encountered: