-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
test: increase Http2ServerResponse test coverage #15074
test: increase Http2ServerResponse test coverage #15074
Conversation
@nodejs/build |
@benjamingr did you mean to cc/ @nodejs/http2 |
@gibfahn no, I wasn't sure if these are build related failures or code related failures. |
Oh I see, I didn't realise the ping was related to CI failures. EDIT: The arm failure is nodejs/build#857, should be fixed now. The other two failures I'm not sure about. |
It looks like OSX has been failing since 5am on 31st so it's probably not related to this. |
|
||
if (path === '/error') { | ||
req.once('error', (err) => assert.strictEqual(err, error)); | ||
res.once('error', (err) => assert.strictEqual(err, error)); |
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.
Is this behavior shared with HTTP1? Can we check?
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.
Will confirm today.
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.
So in h1 it doesn't emit any server-side error events (on req, res or server itself) which seems a bit weird. It causes a socket hang up which then throws an error on the client-side request (ECONNRESET).
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.
This case is calling destroy(err)
on the response, what does happen on H1?
In #14991, errors from the underlining socket are not forwarded to req and res anymore.
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.
Actually, after testing this further, this code is clearly outdated. I was working on it at the same time as you were working on refactoring how the errors are emitted. Will revise.
Looks like the osx build bot is consistently dead. ping @nodejs/build |
Looking into it. |
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. Refs: nodejs#14985
d242bb1
to
ad35687
Compare
@mcollina I had to rebase this locally to get the changes to error handling that you made. I've now rewritten the test to match the new behaviour. Should make more sense now. Thanks for the review! (Also I really should've had |
OSX fail ref: nodejs/build#861 |
|
||
const server = http2.createServer(common.mustCall((req, res) => { | ||
req.once('error', common.mustNotCall()); | ||
req.once('error', common.mustNotCall()); |
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.
this are both req
. I think res
should receive the error, considering the semantics of .destroy(err)
throughout the codebase. Check with H1, but I think we have a bug in the compat layer because of this.
@mcollina I fixed the typo and there's no error emitted on res. Also, checked H1 and it doesn't emit an error on res either. Only the socket receives the error, as far as I can tell. It doesn't bubble up. Looking at the documentation, calling destroy on the ServerResponse isn't actually documented in H1 but it is documented for the IncomingMessage:
And the destroy code for both is equivalent in terms of error handling. |
7605465
to
12dfd8f
Compare
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
a71def2
to
12dfd8f
Compare
Landed in 198fcb9 |
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. PR-URL: #15074 Refs: #14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. PR-URL: nodejs/node#15074 Refs: nodejs/node#14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. PR-URL: #15074 Refs: #14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. PR-URL: #15074 Refs: #14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Modify existing header tests for Http2ServerResponse to include sendDate (get and set) and headersSent. Expand existing test for end to include a check for closed. Add a new test for destroy. PR-URL: #15074 Refs: #14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
A few bundled changes, all for Http2ServerResponse, that are too small for separate PRs:
sendDate
(get and set) andheadersSent
end
to include a check forclosed
destroy
Refs: #14985
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test