Open
Description
Symfony version(s) affected
7.1+
Description
I want to retry requests that timed out with a specified delay.
For timeout=3 and max_retries=3, when I try to send a request to the webhookX endpoint (which includes a sleep to simulate a timeout exception), I receive the following log entries:
[2025-02-27T21:57:44.851034+00:00] http_client.INFO: Try #1 after 5680ms: Idle timeout reached for "http://127.0.0.1:8080/webhookX". {"count":1,"delay":5680} []
[2025-02-27T21:57:44.851414+00:00] http_client.INFO: Request: "POST http://127.0.0.1:8080/webhookX" [] []
[2025-02-27T21:57:47.854169+00:00] http_client.INFO: Try #2 after 15609ms: Idle timeout reached for "http://127.0.0.1:8080/webhookX". {"count":2,"delay":15609} []
[2025-02-27T21:57:47.855437+00:00] http_client.INFO: Request: "POST http://127.0.0.1:8080/webhookX" [] []
[2025-02-27T21:57:50.856308+00:00] http_client.INFO: Try #3 after 37402ms: Idle timeout reached for "http://127.0.0.1:8080/webhookX". {"count":3,"delay":37402} []
[2025-02-27T21:57:50.856729+00:00] http_client.INFO: Request: "POST http://127.0.0.1:8080/webhookX" [] []
[2025-02-27T21:57:53.980913+00:00] app.ERROR: Invalid response from SomeException {"exception":"[object] (App\...........\SomeException(code: 103): Invalid response from ...... at /app/src/.........../SomeException.php:13)\n[previous exception] [object] (Symfony\\Component\\HttpClient\\Exception\\TimeoutException(code: 0): Idle timeout reached for \"http://127.0.0.1:8080/webhookX\". at /app/vendor/symfony/http-client/Chunk/ErrorChunk.php:55)"} []
Even though the context with the pause is set correctly (RetryableHttpClient) and the delay is visible in the logs, it has no effect on the requests.
Please help, I suspect there might be a bug here.
How to reproduce
https://github.com/devmysz/retry-example - small app with instructions (README.md)
Use sleep in some endpoint which you will call, use below config for http-client and make a request:
framework:
http_client:
default_options:
timeout: 3
retry_failed:
http_codes:
0: ['POST'] # 0 - network errors
max_retries: 3
delay: 300000 # milliseconds
multiplier: 3
jitter: 0.2
Possible Solution
No response
Additional Context
No response