Skip to content
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: strictly limit number of concurrent streams #16766

Closed

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Nov 5, 2017

Strictly limit the number of concurrent streams based on the
current setting the MAX_CONCURRENT_STREAMS setting.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

http2

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Nov 5, 2017
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@mscdex mscdex added the http2 Issues or PRs related to the http2 subsystem. label Nov 5, 2017
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);
uint32_t maxSize =
std::min(static_cast<uint32_t>(streams_.max_size()),
maxConcurrentStreams);
Copy link
Member

Choose a reason for hiding this comment

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

If this works it’s going to be implementation-dependent luck, wrapping the size_t to an uint32_t is going to truncate the important bits away on 64-bit platforms. I think upcasting maxConcurrentStreams to size_t is what you’d rather want here, especially since you’re comparing streams_.size() with the result, which generally is a size_t too

Also, common core style is snake_case for local variables

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good point.

Copy link
Contributor

@sebdeckers sebdeckers left a comment

Choose a reason for hiding this comment

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

LGTM, just nit/question.

server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);

client.on('sessionError', console.log);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these logs needed? To be explicit maybe wrap them in common.must(Not)Call.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, no, they're not. just forgot to remove them

@jasnell jasnell force-pushed the http2-limit-concurrent-streams branch from d3ec486 to f55d8e9 Compare November 12, 2017 21:33
@jasnell
Copy link
Member Author

jasnell commented Nov 12, 2017

@jasnell
Copy link
Member Author

jasnell commented Nov 13, 2017

Failed on osx due to a flaky condition, updated and running again: https://ci.nodejs.org/job/node-test-pull-request/11398/

@jasnell
Copy link
Member Author

jasnell commented Nov 13, 2017

Trying again on OSX: https://ci.nodejs.org/job/node-test-pull-request/11402/

@jasnell jasnell force-pushed the http2-limit-concurrent-streams branch from f8767f0 to 62e8632 Compare November 14, 2017 00:58
@jasnell
Copy link
Member Author

jasnell commented Nov 14, 2017

@jasnell
Copy link
Member Author

jasnell commented Nov 14, 2017

CI is green now.

@mcollina ... PTAL

// is being handled on the server side. This is safe
// to ignore on Windows because of the assert.strictEqual
// check in the on('stream') handler which ensures that
// only one request is being handled at any given time.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is safe to ignore. IMHO it is part of the error handling refactoring that we talked about. All client in all OS must get an error in this condition. This test is about the server-side, so it's ok. If we have an issue to track the error handling refactoring, link it.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is a bit incorrect, we're not so much ignoring an error, we're just not expecting one. I'll be investigating further on why later on today, but on windows this second request is serialized out after the first response is received -- which is what should be happening. I actually think it's a bug on the posix side. The test is working exactly as it should. I'm not planning on landing this until I track down the specific issue.

@jasnell jasnell force-pushed the http2-limit-concurrent-streams branch from 62e8632 to 27cebcc Compare November 21, 2017 18:53
@jasnell
Copy link
Member Author

jasnell commented Nov 22, 2017

@nodejs nodejs deleted a comment Nov 22, 2017
@jasnell
Copy link
Member Author

jasnell commented Nov 22, 2017

TODO: ci failed on OSX also. Will investigate

Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting
@jasnell jasnell force-pushed the http2-limit-concurrent-streams branch from 991b61c to 22eb93b Compare January 2, 2018 22:07
@jasnell
Copy link
Member Author

jasnell commented Jan 2, 2018

updated and rebased

CI: https://ci.nodejs.org/job/node-test-pull-request/12377/

@jasnell
Copy link
Member Author

jasnell commented Jan 2, 2018

CI is good. Getting this landed

jasnell added a commit that referenced this pull request Jan 2, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
@jasnell
Copy link
Member Author

jasnell commented Jan 2, 2018

Landed in 653e894

@jasnell jasnell closed this Jan 2, 2018
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
MylesBorins pushed a commit to jasnell/node that referenced this pull request Jan 9, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

PR-URL: nodejs#16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

Backport-PR-URL: #18050
PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 10, 2018
MylesBorins pushed a commit that referenced this pull request Jan 10, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

Backport-PR-URL: #18050
PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
kjin pushed a commit to kjin/node that referenced this pull request May 1, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

Backport-PR-URL: nodejs#18050
PR-URL: nodejs#16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 2, 2018
Strictly limit the number of concurrent streams based on the
current setting of the MAX_CONCURRENT_STREAMS setting

Backport-PR-URL: #18050
Backport-PR-URL: #20456
PR-URL: #16766
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Sebastiaan Deckers <[email protected]>
@MylesBorins MylesBorins mentioned this pull request May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. http2 Issues or PRs related to the http2 subsystem. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants