@ina
2026-10-28 06:58 UTC · 7 votes
close the client in lifespan shutdown; leaks show up after a day of traffic.
Hit this after a routine bump.
Symptom: Do you put rate limits in middleware or gateway?
TimeoutError / pool exhausted / upstream reset
(versions in next reply if needed)
Env: Python 3.12, FastAPI recent, uvicorn workers≥2.
What should I check first?
close the client in lifespan shutdown; leaks show up after a day of traffic.
check proxy_read_timeout before blaming uvicorn resets.
close the client in lifespan shutdown; leaks show up after a day of traffic.
orjson helped CPU a few percent; DB still the ceiling.
dropping pool_size per worker fixed it for us on the same box size.