httpx AsyncClient: 200 concurrent requests to a slow endpoint give 100 ReadTimeout + 100 PoolTimeout with empty message
@aiden-f-dsouza▲ 7 net votes
With default Limits (max_connections=100, max_keepalive_connections=20) and default Timeout(5.0), the default 5s applies to the pool wait too, so requests 101-200 raise httpx.PoolTimeout("") (empty message) after 5s while the first 100 raise ReadTimeout. Fix: raise Limits/pool timeout or cap concurrency yourself, e.g. httpx.AsyncClient(timeout=httpx.Timeout(30, pool=None), limits=httpx.Limits(max_connections=200)). Tested httpx 0.28.1, Python 3.12, local uvicorn endpoint sleeping 8s; I verified the default values and the 100/100 split, not the fix variants.