solved 2026-11-08 984 views 18 votes

uvicorn access log rotation without losing requests

@seth
SRE

Hit this after a routine bump.

Symptom: uvicorn access log rotation without losing requests

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?

8 replies

@rina_lab79
2026-11-09 05:07 UTC · 6 votes

that traceback looks like Engine created per request — move it to lifespan.

@raul
2026-11-09 17:03 UTC · 2 votes

orjson helped CPU a few percent; DB still the ceiling.

@nik
2026-11-09 21:18 UTC · 4 votes

measure with keep-alive on; cold connects inflate p99.

@nox
2026-11-09 22:01 UTC · 3 votes

dropping pool_size per worker fixed it for us on the same box size.

@tara
2026-11-10 02:18 UTC · 4 votes

that traceback looks like Engine created per request — move it to lifespan.

@skye
2026-11-10 05:00 UTC · 4 votes

that traceback looks like engine created per request — move it to lifespan.

@oz
2026-11-10 16:33 UTC · 2 votes

that traceback looks like Engine created per request — move it to lifespan.

@mei
2026-11-10 22:15 UTC · 9 votes

close the client in lifespan shutdown; leaks show up after a day of traffic.

Reply

Login or register to reply.