Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
http: use
autoDestroy: true
in incoming message #33035http: use
autoDestroy: true
in incoming message #33035Changes from 4 commits
dd5a840
a8ea86e
1187814
a5c6690
f60ffd0
5806655
df7ce62
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
IMO this condition is too permissive. In the previous implementation, IncomingMessage doesn't propagate only abort errors if error listener count === 0. After latest changes all errors don't propagated if error listener count === 0.
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.
Good catch, thanks, @wa-Nadoo . I intended to keep the same behavior, so I should implement the stricter check that you suggested.
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 checked again, the check wasn't as strict as you suggested in the branches I modified:
Can you point me to it? Maybe I've missed it.
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.
@wa-Nadoo is correct.
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.
IncomingMessage.destroy(new Error())
without an error listener should be unhandled exceptionThere 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.
Please add a test for 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.
I think I got confused, the check is indeed in functions that should be called only when aborting if I am not mistaken. I'll fix this and add a test.
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 fixed this. Again, thanks @wa-Nadoo and @ronag
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.
Sorry, I need to reopen this. I don't think that the behavior was as you explained in the previous implementation. In fact, in
http_server
and_http_client
, the points where an error is emitted are in the abort logic, and only if there are listeners attached to the event. That, and the fact the IncomingMessage wasn't implementing a standard destroy (therefore, it wasn't itself emitting anerror
event), made it emit an error event only in case of abort if there were event handlers.Something that I think proves this is the fact that in
_http_client
, theerror
event ofres
is no bubbled up toreq
. The same goes for_http_server
. I think maybe this example explains this: https://github.com/nodejs/node/pull/33035#discussion_r543109670.`I added some tests, ptal.