-
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
uncaughtException not called with http.get() #5555
Comments
Wrapped that one up as a test that uses common / assert. Here's a fun bit... everything hangs on v5, but passes on v4. BUT if we introduce a timeout (as we would need for the test) everything passes. I am going to bisect and find out what introduced this weirdness |
Git bisect is showing that the regression was created by #5419 /cc @chrisdickinson @indutny @trevnorris edit: here is the test I used --> https://gist.github.com/TheAlphaNerd/6615a27684deb682dfe7 |
As noted in #5555 the changes to http_parser to use `MakeCallback` have caused a regression that stops Throws from propagating inside of the http client libs. A test and more information can be found at https://gist.github.com/TheAlphaNerd/6615a27684deb682dfe7 This revert is being applied directly to v5.x As such will have no PR-URL. Fix: #5555
@trevnorris In #4507, we had talked about the fact that not having an external ( Putting back an external verbose handler on the stack in I need to improve my knowledge about V8's exception handling before being able to help figuring out a way to solve that problem without introducing this regression. |
I'm assuming you were referring to the following code from https://gist.github.com/TheAlphaNerd/6615a27684deb682dfe7:
The reason why that ends up emitting an Replacing the first line of that gist with |
@misterdjules good eye... womp I've updated the gist |
@misterdjules I say we add the |
@trevnorris Sounds good to me. |
Almost have it working. Unfortunately is breaking the following from parser[kOnHeadersComplete] = function(info) {
throw new Error('hello world');
};
parser.reinitialize(HTTPParser.REQUEST);
assert.throws(function() {
parser.execute(request, 0, request.length);
}, Error, 'hello world'); The error is able to bubble all the way and not be caught by |
So it looks like |
If you put back external exception handlers ( Therefore, that JavaScript exception handler is not the one found when unwinding the stack to find the appropriate exception handler, and instead the external exception handler is found. Because that exception handler is verbose, a message is emitted though, which is handled by Using plain |
See my previous comment above. Basically what's happening with the current 5.7.1 version is:
Now what if we add an exception handler back in
And then finally, the following happens when we put back external exception handlers in
This last behavior is what fixes this issue, and |
@misterdjules I think the following is pretty much what you explained: trevnorris@8d7b346 While that patch does fix all tests, problem is it now looses calls to the pre/post callbacks of async wrap. |
@misterdjules I'm not 100% sure what I'm getting at here, but what if the external exception handler could be tied to the |
@trevnorris It sounds like it could work. |
@misterdjules Have an initial PR up for the fix #5571. I feel this is completely a temporary fix to get the release out, and to avoid backing the entire patch out. Will start investigating how to propagate the external exception handler with the |
@trevnorris Actually, would you mind trying the following patch:
instead of #5571 and let me know what you think? Basically, returning |
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Ref: #7048 Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Ref: #7048 Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Ref: #7048 Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Ref: #7048 Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
With the following example, I would expect uncaughtException to be triggered. It works on v4.x but not on latest v5.
The text was updated successfully, but these errors were encountered: