Unrecoverable httpx.PoolTimeout error after multiple httpcore.ReadTimeout errors when using the same AsyncClient
#3585
Unanswered
RogerThomas
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered the following issue when an upstream service became unavailable for approximately 5 minutes. This caused downstream requests to fail, and, even after the upstream service recovered, the downstream service remained in an unrecoverable state due to repeated
httpx.PoolTimeouterrors.httpx version:
0.28.1
Current Behavior:
When using a single
httpx.AsyncClient, after some amount of repeatedhttpcore.ReadTimeouterrors, the client becomes unusable when it starts exhibitinghttpx.PoolTimeouterrors.I.e. once the client gets in to this state, it becomes unable to make any further requests.
Expected Behavior:
After repeated
httpcore.ReadTimeouterrors, the AsyncClient should be able to still make requests to healthy endpoints.Steps To Reproduce:
task serve-upstream -- truetask serve-maintask hey-httpxhttpx.PoolTimeouterrors can be seenhey-httpxtask from step 5 (ctrl-C)task serve-upstream -- falsetask test-upstreamand sending a request to main service (to show that it is now completely broken)task test-main(should return 500s)Anything else:
Can confirm the issue is with httpx as the same steps to reproduce can be run as above but with
task hey-niquestsinstead oftask hey-httpx. This causes niquests to be used as the http client to fetch the upstream service.When using niquests, even after running the 'broken' upstream service for an abitrary amount of time, once you stop it and switch it to the 'fixed' service, the main service will always recover and will then continue to accept and return successful requests/responses
There may be easier/more-concise ways of reproducing this issue, but I wanted to share the exact scenario we encountered the issue in.
Beta Was this translation helpful? Give feedback.
All reactions