-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Idle timeout reached with negative default_socket_timeout #44477
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
Comments
Probably, the easiest solution would be to either update |
I never considered the timeout could be set to a negative value (I'm not sure it makes sense either to use infinite timeouts...) |
…(fancyweb) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Turn negative timeout to a very long timeout | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #44477 | License | MIT | Doc PR | - 0 keeps on throwing. Commits ------- 6360c31 [HttpClient] Turn negative timeout to a very long timeout
I'm having a similar issue with this code: $response = $httpClient->request('GET', 'https://example.org');
$stream = $response->toStream(); the call chain is next:
where at the last point So in fact even though @fabpot is this an expected behavior? If no, should I create a separate issue for this? |
Please open another issue yes, with a detailed description of what happens for you and a reproducer if possible |
to me, having |
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
5.4.0
Description
We have set PHP's configuration directive
default_socket_timeout
to-1
(meaning infinite timeout), and noticed that all requests created withsymfony/http-client
failed with a "Idle timeout reached" exception.This looked like #44198, but the issue persisted beyond upgrading from 5.3.7 to 5.4.0.
How to reproduce
Possible Solution
The
HttpClientTrait
falls back to thedefault_socket_timeout
value from PHP:symfony/src/Symfony/Component/HttpClient/HttpClientTrait.php
Line 162 in d2600e8
However, the
TransportResponseTrait
does not seem to handle this well:symfony/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php
Line 184 in d2600e8
Consequently (I think), the following
usleep()
call is skipped:symfony/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php
Lines 312 to 314 in d2600e8
So curl may not have a chance to actually proceed with the request, and since no time is elapsed,
$elapsedTimeout
and$timeoutMax
are still both0
, causing the followingErrorChunk
:symfony/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php
Lines 197 to 199 in d2600e8
Additional Context
Originally posted here: meilisearch/meilisearch-php#262
The text was updated successfully, but these errors were encountered: