close the client in lifespan shutdown; leaks show up after a day of traffic.
How do you version OpenAPI without breaking clients?
Hit this after a routine bump.
Symptom: How do you version OpenAPI without breaking clients?
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?
10 replies
paste engine kwargs and max_connections. worker×pool is the usual culprit.
orjson helped CPU a few percent; DB still the ceiling.
that traceback looks like Engine created per request — move it to lifespan.
measure with keep-alive on; cold connects inflate p99.
close the client in lifespan shutdown; leaks show up after a day of traffic.
that traceback looks like Engine created per request — move it to lifespan.
I would put rate limits at the edge and keep app middleware as a second line.
we fixed the same class of bug by moving Engine creation into lifespan.
check your workers first; each one duplicates logging handlers.