You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
You may create an example app to reproduce this behavior. This can be a small app with one command that you publicly push on Github with a little readme (such as "launch this command to reproduce"), so maintainers and contributors can clone your reproducer and quickly evaluate/debug it. This would greatly help us to investigate on the problem!
It looks like the wait time for the request to complete + delay must fit within the timeout setting of the HTTP client (default 60s, 3s in the example), which is contradictory in this case. When the timeout occurs, it means this value has already been reached, and the delay will never take effect.
It works better with other responses, such as 503, but it still won’t wait longer than the timeout. For example, if the timeout is 60s, the request responds with a 503 after 10s, and the delay should be 120s, it will be retried after 50s, not 120s.
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:
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:
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: