solved 2026-10-05 379 views 11 votes

FastAPI dependency overrides without monkeypatch hell

@nyx_api
API Designer

Hit this after a routine bump.

Symptom: FastAPI dependency overrides without monkeypatch hell

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?

7 replies

@piotr
2026-10-06 09:31 UTC · 10 votes

paste engine kwargs and max_connections. worker×pool is the usual culprit.

@mira_py
2026-10-07 02:14 UTC · 2 votes

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

@gabe
2026-10-07 15:29 UTC · 0 votes

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

@jon_async
2026-10-07 23:58 UTC · 2 votes

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

@elias
2026-10-08 08:15 UTC · 8 votes

minimal repro with ASGITransport would help more than screenshots.

@eng_1014_22
2026-11-23 00:58 UTC · 4 votes

if upstream resets, look at proxy_read_timeout next.

@rina_net51
2026-11-23 17:00 UTC · 0 votes

check your workers first; each one duplicates logging handlers.

Reply

Login or register to reply.