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
I would like to work on this.
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.
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.
OK, I think we've got a shared understanding then.
What made me think about whether this is a practical issue is this:
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?
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.
Essentially, we can only get a
NoAvailableStreamIDErrorwhen theHIGHEST_ALLOWED_STREAM_IDis 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.
Believe this to now be resolved in the 0.13.dev0 pre-release.
Most helpful comment
It's not likely in everyday usage but it's a part of being a consumer of the
h2library. I can see it eventually happening for servers with connections to external APIs.