-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Cannot multiplex requests on a single H2 connection #246
Comments
Indeed, currently it limits concurrent requests instead of concurrent connections. I guess having the same connection limit for both isn't what users generally want. |
sure! Note that this is not my issue here :) Is there a way to multiplex several requests on a single h2 connection? That's what I don't know how to do here. Is that a known limitation? |
Sure, that will happen by default, but if you limit to a single concurrent request, it will obviously not happen. |
But it should be possible to have one single connection to a remote host and still do several h2 requests, since that's a main feature of the protocol. curl allows it. |
H2 connections can have many streams per connection. Only a single connection is actually made. The problem is that @kelunik I think we should change |
The way it's currently written, it could have been a simple interceptor, I guess. @trowski I don't see a way to implement that in the current implementation, because we don't ever have access to the connection object in |
Oh yes, right… it's only returning |
This is the callgraph of the above script without the https://blackfire.io/profiles/20a80a98-340c-4327-b966-4c9db0c4f679/graph As you can see, it opens several connections to the host. I'll have a closer look, but if you have some hints meanwhile, I'd be happy to read them. |
OK, here is what happens: the script requests more than the maximum number of allowed concurrent streams. This means Here is the Blackfire profile that shows only one connection is opened: I suppose the pool logic could be improved :) |
Thanks for figuring that out… I was scratching my head for the last half hour trying to figure out why the H2 connection wasn't being reused. Can you try removing |
No difference, it still opens new connections after the threshold. |
EDIT: I was trying the script you have on the symfony PR, not the one above. Let me investigate further. |
@nicolas-grekas Just pushed 1181944, which should fix your problem. Please pull the latest master and give it a try. 😃 |
Confirmed! That's the right direction apparently :) |
@kelunik Yes, I realized that, but I wasn't sure about what a good solution there would be and I wanted to confirm that at least solved @nicolas-grekas's problem. First idea I had is examine the first connection returned, and if HTTP/1.x, assume that the next one will also be HTTP/1.x and immediately make a new connection. |
If a prior HTTPS connection returned a non-H2 connection, the pool assumes the next connection will also not be H2. Related to #246.
If a prior HTTPS connection returned a non-H2 connection, the pool assumes the next connection will also not be H2. Related to #246.
Closing, as this has been fixed on master. |
Thank you! |
Yup, please. |
Spotted at symfony/symfony#35115 (comment)
The following script adapted from the examples doesn't multiplex the requests.
Note that we limit to one single connection. If we remove this limit, one connection per request is made and all works concurrently - but then this is no different than using HTTP/1.1.
The text was updated successfully, but these errors were encountered: