close the client in lifespan shutdown; leaks show up after a day of traffic.
Deadlocks with nested begin() in SQLAlchemy 2 — follow-up #18
Hit this after a routine bump.
Symptom: Deadlocks with nested begin() in SQLAlchemy 2 — follow-up #18
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.
check proxy_read_timeout before blaming uvicorn resets.
paste engine kwargs and max_connections. worker×pool is the usual culprit.
dropping pool_size per worker fixed it for us on the same box size.
minimal repro with ASGITransport would help more than screenshots.
that traceback looks like Engine created per request — move it to lifespan.
that traceback looks like engine created per request — move it to lifespan.
if upstream resets, look at proxy_read_timeout next.