-
Notifications
You must be signed in to change notification settings - Fork 31k
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
async_hooks: async hook stack corruption when exception prevents AsyncResource.emitAfter being called. #16156
Comments
That isn’t the case here because you have wrapped the call to
Yeah, that’s how the handler should look like. I think your example here would make a good addition to the docs, would you be interested in submitting it as a PR? |
@addaleax No! That is not how it should look. We have code specifically in place such that isn't necessary. https://github.com/nodejs/node/blob/d828c01a656c41454adda3876eaeaa2c001f55d8/lib/internal/bootstrap_node.js#L392L401 I think it is simply that the code block should be after |
@AndreasMadsen I don’t think so – in the situation described here the current approach (that I do want to get rid of in place of proper C++ RAII handling) is not really going to work…
Changing anything inside the uncaught exception handler isn’t going to be effective here? |
Oh, right. But, I'm pretty sure @trevnorris didn't want it to look like that. Because it wasn't robust or something. |
From the EPS.
In the documentation PR I wanted But I think I might have misunderstood the discussion since the discussions mostly deal with when there are no |
I would agree that a wrapper like |
Case above also happens when there is no |
Doesn't look like there is anything actionable here so I'm going to close it out. That said feel free to re-open if you feel I'm wrong. |
According to
async_hooks
docs,However, this doesn't seem to work in practice. If I set up a simple AsyncResource to bind a function to its own execution context,
and use it like
Then I get the following output from node:
This happens even if I set up handlers for uncaught exceptions and rejections:
If I change
BoundFunction#run
to look likethe error goes away. I am fine with my handler looking like that, but it's a bit confusing that the docs seem to say that it shouldn't be required.
The text was updated successfully, but these errors were encountered: