You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Open new HTTP/2 connections when stream space is exhausted. #283
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. "
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.
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 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.
Activity
gdhameeja commentedon Sep 7, 2019
I would like to work on this.
Fix encode#283
florimondmanca commentedon Sep 21, 2019
Is this actually an issue for us?
h2sets itsHIGHEST_ALLOWED_STREAM_IDto 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 theMAX_CONCURRENT_STREAMSlimit imposed byh2(100 by default) will hit us before that.sethmlarson commentedon Sep 21, 2019
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.
florimondmanca commentedon Sep 21, 2019
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
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?sethmlarson commentedon Sep 21, 2019
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.ojii commentedon Feb 18, 2020
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.
lovelydinosaur commentedon Apr 30, 2020
Believe this to now be resolved in the 0.13.dev0 pre-release.