Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] Potential regression around timeouts and retry strategy in 7.0.3. #53886

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
ldebrouwer opened this issue Feb 9, 2024 · 0 comments

Comments

@ldebrouwer
Copy link

Symfony version(s) affected

7.0.3

Description

I currently make extensive use of the Async AWS project across varying platforms, and ever since I've upgraded symfony/http-client from version 7.0.2 to 7.0.3 I've seen an influx of issues that I believe were handled accordingly previously, or at least gracefully retried.

I believe that #53506 may have inadvertently caused a regression, or caused unintended side-effects elsewhere in the package.

In terms of real world effects this means I see around 25 exceptions being thrown per 4 million requests, where I previously saw none. It's not a lot, but it's there, and it's noisy.

Please find a snippet of a stack trace below;

        "class": "Symfony\\Component\\HttpClient\\Exception\\TimeoutException",
        "message": "Idle timeout reached for \"https://sts.eu-west-1.amazonaws.com/\".",
        "code": 0,
        "file": "/var/www/html/vendor/symfony/http-client/Chunk/ErrorChunk.php:56",
        "trace": [
          "/var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php:70",
          "/var/www/html/vendor/symfony/http-client/Response/CommonResponseTrait.php:144",
          "/var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php:97",
          "/var/www/html/vendor/async-aws/core/src/Response.php:147",
          "/var/www/html/vendor/async-aws/core/src/Result.php:69",
          "/var/www/html/vendor/async-aws/core/src/Result.php:137",
          "/var/www/html/vendor/async-aws/core/src/Sts/Result/AssumeRoleWithWebIdentityResponse.php:112",
          "/var/www/html/vendor/async-aws/core/src/Credentials/WebIdentityProvider.php:116",
          "/var/www/html/vendor/async-aws/core/src/Credentials/WebIdentityProvider.php:53",
          "/var/www/html/vendor/async-aws/core/src/Credentials/ChainProvider.php:54",
          "/var/www/html/vendor/async-aws/core/src/Credentials/CacheProvider.php:38",
          "/var/www/html/vendor/async-aws/core/src/AbstractApi.php:146",
          "/var/www/html/vendor/async-aws/sqs/src/SqsClient.php:722",

Apologies for truncation of the stack trace, but this should give some insight.

In the example above you see that an idle timeout was reached for https://sts.eu-west-1.amazonaws.com/. It's not like I've got a super restrictive timeout configured for the HttpClient, as a matter of fact, even bumping it to 30 seconds didn't alleviate this issue.

Reverting back to 7.0.2 completely made this issue go away. I'm seeing no failed requests (due to incorrect STS credentials), which I believe is due to the fact that the HttpClient retries idle timeouts accordingly up until 7.0.2.

Of course I could try and handle this by creating a custom credential provider that I'd use with the AsyncAWS packages, but that would kind of defeat the purpose of using the RetryableHttpClient in conjunction with a retry strategy.

How to reproduce

This is nigh impossible to reproduce. As I mentioned, I'm only seeing a handful of exceptions over millions of requests, which makes it incredibly hard to pin down.

Possible Solution

I would suggest temporarily reverting #53506, and seeing which side-effects these changes have in the larger ecosystem of the package. It's clear that an exception now bubbles up, which was retried gracefully previously.

Additional Context

No response

@ldebrouwer ldebrouwer added the Bug label Feb 9, 2024
nicolas-grekas added a commit that referenced this issue Feb 14, 2024
This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[HttpClient] Make retry strategy work again

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #53886
| License       | MIT

PR #53506 accidentally disabled the retry functionality. I reverted that PR and added a small test to make sure this does not happen again.

Thank you `@ldebrouwer` for reporting this.

FYI `@nicolas`-grekas `@rmikalkenas`, I will try to find an other solution to fix #52587. But I'll do that in a separate PR to get a quick merge on this one.

Commits
-------

9a5797d [HttpClient] Make retry strategy work again
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

4 participants