Web Development
Bug Report
FastAPI QueuePool limit reached: leaked SQLAlchemy sessions in dependencies
Every few hours our FastAPI service started failing with QueuePool limit of size 5 overflow 10 reached, then recovered on its own. Two code paths opened SQLAlchemy sessions nobody closed, and only the garbage collector gave the connections back. Full repro, fix and pool monitoring inside.