-
-
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
Tally active requests in pool to close unsuited, idle connections #259
Conversation
@nicolas-grekas This PR is a more robust solution, as @kelunik pointed out that the same situation could happen with multiple HTTP/2 requests, followed by an HTTP/1.x request (and certainly in other scenarios). This PR now closes connections in the pool if they are idle but unable to fulfill a new request. This PR also relaxes reusing an HTTP/1.x keep-alive connection without an explicit timeout (which was the issue that caused the timeouts you saw) for a |
if (!$this->isAdditionalConnectionAllowed($uri) | ||
&& ($this->activeRequestCounts[$connectionId] ?? 0) === 0 | ||
) { | ||
// No additional connections allowed, but this connection is idle and unsuited for this request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the comment, we could refactor the second condition of the if
into an $this->isIdle($connection)
method.
Fixes #256.