Skip to content

[HttpClient] "Idle timeout reached" error when streaming response #44934

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

Closed
vyshkant opened this issue Jan 6, 2022 · 4 comments
Closed

[HttpClient] "Idle timeout reached" error when streaming response #44934

vyshkant opened this issue Jan 6, 2022 · 4 comments

Comments

@vyshkant
Copy link
Contributor

vyshkant commented Jan 6, 2022

Symfony version(s) affected

5.3.13

Description

I have default_socket_timeout set to -1 (which is supposed to mean some big timeout). I noticed a bug, which appears when I'm trying to stream response: I have "Idle timeout reached" error.

How to reproduce

$response = $httpClient->request('GET', 'https://example.org');
$stream = $response->toStream();

which gets us the next call chain

where at the last point $timeoutMax equals 0, so any elapsed time will exceed this value.

Possible Solution

$timeoutMax value should be set to some big number instead of zero.

Additional Context

Relevant issues are: #44477 #44878

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 6, 2022

I'm not sure I understand why this is different than #44477. Did you try the patch in #44878? Does it fix the issue for you?
Note that the fix has not been released and will be part of 5.3.14.

@vyshkant
Copy link
Contributor Author

vyshkant commented Jan 7, 2022

I'm not sure I understand why this is different than #44477. Did you try the patch in #44878? Does it fix the issue for you?
Note that the fix has not been released and will be part of 5.3.14.

No, I didn't try that patch. But as far as I see, the patch is about setting the correct timeout value to the $options object during request method execution, while my problem is about interpreting -0.0 value (which is hardcoded to be this value regardless of default_socket_timeout value) during response streaming.

@nicolas-grekas
Copy link
Member

Can you please try the patch?

@vyshkant
Copy link
Contributor Author

vyshkant commented Jan 7, 2022

Can you please try the patch?

Yep! I'll try it after it's released, will let you know the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants