Skip to content

http2: add failing writes with destroy test - #19852

Closed
mafintosh wants to merge 4 commits into
nodejs:masterfrom
mafintosh:add-failing-http2-test-with-writes
Closed

http2: add failing writes with destroy test#19852
mafintosh wants to merge 4 commits into
nodejs:masterfrom
mafintosh:add-failing-http2-test-with-writes

Conversation

@mafintosh

@mafintoshmafintosh commented Apr 6, 2018

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Simplified 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

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Apr 6, 2018
@mafintosh

Copy link
Copy Markdown
MemberAuthor

/cc @jasnell@addaleax

@mafintoshmafintosh added the http2 Issues or PRs related to the http2 subsystem. label Apr 6, 2018

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

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 :/

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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 in sequential rather than parallel.

  • 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().

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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...

Copy link
Copy Markdown
MemberAuthor

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.

@Trott
Trottforce-pushed the add-failing-http2-test-with-writes branch from be13bfe to 5b55170CompareApril 6, 2018 22:05
@Trott

Trott commented Apr 6, 2018

Copy link
Copy Markdown
Member

This would need to be rebased due to #19854, sorry :/

I did the rebase, so no need to worry about that anymore.

@Trott

Trott commented Apr 6, 2018

Copy link
Copy Markdown
Member

@nodejs/http2 @nodejs/testing

@BridgeAR

Copy link
Copy Markdown
Member

@mafintosh
mafintoshforce-pushed the add-failing-http2-test-with-writes branch from 5b55170 to 17630b1CompareApril 9, 2018 09:58
@mafintosh

mafintosh commented Apr 9, 2018

Copy link
Copy Markdown
MemberAuthor

Fixed the comments. PTAL @addaleax@Trott@jasnell

@mafintosh
mafintoshforce-pushed the add-failing-http2-test-with-writes branch from 17630b1 to cf5a405CompareApril 9, 2018 11:26
@mcollina

Copy link
Copy Markdown
Member

This test is failing and it is showing a bug :/.

I've run why-is-node-running with it, and we just have:

There are 7 handle(s) keeping the process running
# Timeout
/Users/matteo/Repositories/node/test/parallel/test-http2-many-writes-and-destroy.js:35 - setTimeout(function () {
# TCPWRAP
/Users/matteo/Repositories/node/test/parallel/test-http2-many-writes-and-destroy.js:17 - const client = http2.connect(url);
# HTTP2SESSION
(unknown stack trace)
# HTTP2SETTINGS
(unknown stack trace)
# Timeout
(unknown stack trace)
# HTTP2SESSION
(unknown stack trace)
# HTTP2STREAM
(unknown stack trace)

I have a possible fix coming, pushing directly to this PR.

@mcollina
mcollinaforce-pushed the add-failing-http2-test-with-writes branch from cf5a405 to 9cc9a9dCompareApril 11, 2018 15:39
@mafintosh

Copy link
Copy Markdown
MemberAuthor

@mafintosh

Copy link
Copy Markdown
MemberAuthor

🎉 @mcollina added a fix for my failing test case \o/

if (!socket.destroyed) {
if (!error) {
setImmediate(socket.end.bind(socket));
setImmediate(socket.destroy.bind(socket));

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a classic @mcollina fix :)

@jasnell

Copy link
Copy Markdown
Member

LGTM, especially with the fix :-)

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 12, 2018
@BridgeAR

Copy link
Copy Markdown
Member

Rerunning the CI because there were a couple of failures https://ci.nodejs.org/job/node-test-pull-request/14265/

@addaleax

Copy link
Copy Markdown
Member

@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…

@addaleaxaddaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 14, 2018
@mcollinamcollina mentioned this pull request Apr 24, 2018
@apapirovski

apapirovski commented Apr 24, 2018

Copy link
Copy Markdown
Contributor

@mcollina

Copy link
Copy Markdown
Member

@apapirovski I've added your commit on top.

@mcollina

Copy link
Copy Markdown
Member

@apapirovski
apapirovskiforce-pushed the add-failing-http2-test-with-writes branch from e3f9922 to c3c1f3dCompareMay 10, 2018 14:18
@apapirovski

apapirovski commented May 10, 2018

Copy link
Copy Markdown
Contributor

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).

@apapirovski
apapirovskiforce-pushed the add-failing-http2-test-with-writes branch 2 times, most recently from 56c994c to a402353CompareMay 10, 2018 14:44
@apapirovski
apapirovskiforce-pushed the add-failing-http2-test-with-writes branch from a402353 to 53eb584CompareMay 10, 2018 14:55
@apapirovski

Copy link
Copy Markdown
Contributor

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/)

@mcollina

Copy link
Copy Markdown
Member

@jasnell@addaleax@trivikr PTAL

@jasnell

Copy link
Copy Markdown
Member

Still LGTM

apapirovski pushed a commit that referenced this pull request May 13, 2018
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
@apapirovski

Copy link
Copy Markdown
Contributor

Landed in b60b183

addaleax pushed a commit that referenced this pull request May 14, 2018
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
@addaleaxaddaleax mentioned this pull request May 14, 2018
addaleax pushed a commit that referenced this pull request Jun 29, 2018
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 9, 2018
rvagg pushed a commit that referenced this pull request Aug 16, 2018
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
@TrottTrott mentioned this pull request Nov 25, 2018
@lundibundilundibundi mentioned this pull request Dec 8, 2019
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2Issues or PRs related to the http2 subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: server.close not behaving like http1 or net

9 participants

@mafintosh@Trott@BridgeAR@mcollina@jasnell@addaleax@apapirovski@trivikr@nodejs-github-bot