-
Notifications
You must be signed in to change notification settings - Fork 30k
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
http2: [compat api] allow 'aborted' event on Http2ServerResponse
instances and trigger those on session.socket's 'sessionError'
#32937
Conversation
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.
cc @nodejs/tsc
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.
cc @nodejs/tsc
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
@nodejs/http2 @nodejs/tsc PTAL |
cc @jasnell |
I think the idea of #28267 was that |
emit `aborted` on `Http2ServerRequest` instance, added docs and tests, and removed older changes
aborted
on Http2ServerRequest
instances
aborted
on Http2ServerRequest
instancesaborted
on Http2ServerRequest
instances
Can you add a test that checks that if you get a |
aborted
on Http2ServerRequest
instancesHttp2ServerResponse
instances and trigger it on 'sessionError'
Http2ServerResponse
instances and trigger it on 'sessionError'Http2ServerResponse
instances and trigger those on session.socket's 'sessionError'
@ronag How did you invoke the |
@ronag PTAL |
I don't remember. Was a long time ago. I probably got it in production somewhere. |
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'm not sure this is how HTTP/1 behaves. Please see comment and confirm. If that's not how HTTP/1 behaves it might make sense to make it so as part of a semver-major.
Also, this doesn't actually solve #28267 so we should probably remove the reference.
@@ -15,7 +15,7 @@ const server = h2.createServer(common.mustCall(function(req, res) { | |||
req.on('error', common.mustNotCall()); | |||
res.on('error', common.mustNotCall()); | |||
req.on('aborted', common.mustCall()); | |||
res.on('aborted', common.mustNotCall()); | |||
res.on('aborted', common.mustCall()); |
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.
Can you confirm that the corresponding code for HTTP1 would actually emit 'aborted'
here?
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.
@ronag ServerResponse
did not emit 'aborted'
with the following code.
// differences from the HTTP/2 corresponding code
// IncomingMessage: did not emit 'error', emitted only 'aborted' event
// ServerResponse: did not emit neither 'error' nor 'aborted' events
const server = http.createServer(common.mustCall((req, res) => {
// req.on('error', common.mustCall()) // fails
// res.on('error', common.mustCall()) // fails
req.on('aborted', common.mustCall(() => {
assert.ok(req.aborted); // passes
}));
// res.on('aborted', common.mustCall()) // fails
res.write('xyz');
server.close();
})).listen(0, common.mustCall(function () {
const request = http.get({
path: '/',
port: server.address().port
}, function(res) {
res.on('data', common.mustCall((d) => {
request.destroy();
}));
});
}));
8ae28ff
to
2935f72
Compare
Ping @ronag |
Given #32937 (comment). What is this fixing? The way I see it this actually diverges from the http/1 behavior? |
@ronag Feel free to close this if you think that's the best option here. However, at this point, I'm interested in the best approach we can take to fix #28267 given its irreproducibility? |
Nonetheless, I've run into |
EDIT: Removed
Fixes: #28267
in accordance to #32937 (review)Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes