-
Notifications
You must be signed in to change notification settings - Fork 107
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
Don't exceed MAX_CONCURRENT_STREAMS
when sending HTTP/2 requests
#85
Comments
Also noting http://http2.github.io/http2-spec/index.html#rfc.section.9.1 "Clients SHOULD NOT open more than one HTTP/2 connection to a given host and port pair" means that we shouldn't just open up a new conenction when we hit this limit. |
I'm familiar to asyncio but new to this project. Before I start working on this, my intuitive solution would be to wrap https://github.com/encode/httpx/blob/master/httpx/_dispatch/http2.py#L58-L63 in a semaphore, ideally one inheriting from the Does that sound about right? |
@ndhansen Exactly correct yup, although I'd suggest on resolving this in https://github.com/encode/httpcore rather than here, since the intent is to move to that package for providing the core network dispatching. |
Thanks @tomchristie! Is there a branch in this project that already uses httpcore, or should I open a PR containing the equivalent code when the PR in httpcore is approved? |
Moving this issue to httpcore, I feel this has already been addressed but we need to check. |
Yep, this issue is still present. |
Okay, so there's two related bit here...
Really we ought to tackle the second of those points, and then treat the first as an additional enhancement on top of that. |
We should raise Are we already dealing with the MAX_CONCURRENT_STREAMS case, here?... https://github.com/encode/httpcore/blob/master/httpcore/_async/http2.py#L94-L98 |
Blergh, sorry - I'm mixing up max concurrent streams vs. max stream id. |
I suppose we want to wrap this block up in a semaphore... https://github.com/encode/httpcore/blob/master/httpcore/_async/http2.py#L102-L105 |
So, looks to me like https://github.com/encode/httpcore/pull/38/files has it about right, but really we should wrap the semaphore around the post-init part of the request method. |
Bug described in encode/httpx#281 where HTTPX doesn't support waiting for other streams to close before creating a new stream on an HTTP/2 connection.
The text was updated successfully, but these errors were encountered: