Skip to content

Open new HTTP/2 connections when stream space is exhausted. #283

Closed

Description

@lovelydinosaur

http://http2.github.io/http2-spec/index.html#StreamIdentifiers "Long-lived connections can result in an endpoint exhausting the available range of stream identifiers. A client that is unable to establish a new stream identifier can establish a new connection for new streams. "

Somewhat related to #282

Activity

  1. gdhameeja commented on Sep 7, 2019

    @gdhameeja
    Contributor

    I would like to work on this.

  2. added a commit that references this issue on Sep 10, 2019
    0e2b218
  3. florimondmanca commented on Sep 21, 2019

    @florimondmanca
    Contributor

    Is this actually an issue for us?

    h2 sets its HIGHEST_ALLOWED_STREAM_ID to 2^31 - 1, which is ~2^30 streams we can open (client-side stream IDs are always odd), i.e. about 1M streams. Are we ever going to open that many connections, and still want to open more after that point? Surely the MAX_CONCURRENT_STREAMS limit imposed by h2 (100 by default) will hit us before that.

  4. sethmlarson commented on Sep 21, 2019

    @sethmlarson
    Contributor

    Stream space is number of requests on a single connection, since each request requires its own stream. The concurrent streams limit is the number of requests you're allowed to have outstanding before making a new request.

  5. florimondmanca commented on Sep 21, 2019

    @florimondmanca
    Contributor

    OK, I think we've got a shared understanding then.

    What made me think about whether this is a practical issue is this:

    https://github.com/python-hyper/hyper-h2/blob/385ced7d30a7ccb9b3f163f1bc4e90cf2f4ee184/h2/connection.py#L641-L651

    Essentially, we can only get a NoAvailableStreamIDError when the HIGHEST_ALLOWED_STREAM_ID is reached, which is when we're making 1 million requests to the same host via a single connection. How likely is that to happen? Or maybe I'm completely missing something?

  6. sethmlarson commented on Sep 21, 2019

    @sethmlarson
    Contributor

    It's not likely in everyday usage but it's a part of being a consumer of the h2 library. I can see it eventually happening for servers with connections to external APIs.

  7. ojii commented on Feb 18, 2020

    @ojii

    Essentially, we can only get a NoAvailableStreamIDError when the HIGHEST_ALLOWED_STREAM_ID is reached, which is when we're making 1 million requests to the same host via a single connection. How likely is that to happen? Or maybe I'm completely missing something?

    We do about 1 million requests per day to a single host (APNS) in our application, so to me it doesn't seem too unrealistic to hit this limit, if a connection stays open for some time.

  8. lovelydinosaur commented on Apr 30, 2020

    @lovelydinosaur
    MemberAuthor

    Believe this to now be resolved in the 0.13.dev0 pre-release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghttp/2Issues and PRs related to HTTP/2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions