-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add failing writes with destroy test #19852
http2: add failing writes with destroy test #19852
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.
This would need to be rebased due to #19854, sorry :/
|
||
setTimeout(() => { | ||
assert(false, 'should exit before 10s'); | ||
}, 10000).unref(); |
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 we've been removing these kinds of checks to avoid timeout-related flakiness in tests -- the test runner enforces its own timeout anyway. (/cc @Trott)
If you want to have actual timing guarantees, you can try to remove the dependency on networking and use something like test/parallel/test-http2-generic-streams.js
does.
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.
Other things to be aware of, just sorta FYI, you don't need to do anything with these at this time unless you think you should:
-
Tests with timers like this can become unreliable if the test is competing with other tests for resources. This unreliability is introduced surprisingly often on a few platforms in CI (particularly FreeBSD, I think because
test.py
decides it has 48 processors or something but they're not "real" processors--never really dug into it TBH, but you get the idea). To avoid the problem, the test can be put insequential
rather thanparallel
. -
If you think 10 seconds is plenty for most things, but that maybe a Raspberry Pi could use a little more time than that, use
common.platformTimeout()
.
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.
👍
client.close(); | ||
})); | ||
|
||
req.once('data', () => req.destroy()); |
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 this could be common.mustCallAtLeast()
'ed, to make sure it's run?
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.
Since it's a once
handler, it could be common.mustCall()
.
If the test will fail without the handler running, then I'm OK omitting common.mustCall()
. And I'm OK including it. Either way...
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.
fixed. added a mustCall, since it's a once.
be13bfe
to
5b55170
Compare
I did the rebase, so no need to worry about that anymore. |
@nodejs/http2 @nodejs/testing |
5b55170
to
17630b1
Compare
17630b1
to
cf5a405
Compare
This test is failing and it is showing a bug :/. I've run why-is-node-running with it, and we just have:
I have a possible fix coming, pushing directly to this PR. |
cf5a405
to
9cc9a9d
Compare
🎉 @mcollina added a fix for my failing test case \o/ |
@@ -1190,7 +1190,7 @@ class Http2Session extends EventEmitter { | |||
// Otherwise, destroy immediately. | |||
if (!socket.destroyed) { | |||
if (!error) { | |||
setImmediate(socket.end.bind(socket)); | |||
setImmediate(socket.destroy.bind(socket)); |
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.
oy! obvious and simple in hindsight.
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.
a classic @mcollina fix :)
LGTM, especially with the fix :-) |
Rerunning the CI because there were a couple of failures https://ci.nodejs.org/job/node-test-pull-request/14265/ |
@mafintosh Can you make sure that the CI failures are unrelated? In particular, at a quick glance https://ci.nodejs.org/job/node-test-commit-osx/17798/nodes=osx1010/console might not be… |
@apapirovski I've added your commit on top. |
e3f9922
to
c3c1f3d
Compare
CI: https://ci.nodejs.org/job/node-test-pull-request/14792/ I added some other fixes for the new changes. I also removed the changes to the http2 pipe test because if that one's getting an ECONNRESET then we shouldn't swallow it. That would indicate the fix here isn't fully correct (e.g. it's possible for us to be still writing meaningful data when the socket is destroyed). |
56c994c
to
a402353
Compare
a402353
to
53eb584
Compare
Ok, the CI is green FWIW. If someone wants to give this a few more looks then we could go ahead and finally land this. (Another CI just to be safe: https://ci.nodejs.org/job/node-test-pull-request/14805/) |
Still LGTM |
Fix a bug where the socket wasn't being correctly destroyed and adjust existing tests, as well as add additional tests. PR-URL: #19852 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Co-authored-by: Matteo Collina <[email protected]>
Landed in b60b183 |
Fix a bug where the socket wasn't being correctly destroyed and adjust existing tests, as well as add additional tests. PR-URL: #19852 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Co-authored-by: Matteo Collina <[email protected]>
Fix a bug where the socket wasn't being correctly destroyed and adjust existing tests, as well as add additional tests. PR-URL: #19852 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Co-authored-by: Matteo Collina <[email protected]>
Fix a bug where the socket wasn't being correctly destroyed and adjust existing tests, as well as add additional tests. PR-URL: #19852 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Co-authored-by: Matteo Collina <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesSimplified the failing http2 test from #19828 into this test case. Basically when doing lots of writes and then destroying the request, the process will hang instead of exiting normally.
Fixes #20630