FastAPI Session Leak Detection: How to Find and Fix Long-Running SQLAlchemy Sessions in Production?
You deploy your FastAPI app.Everything looks healthy.
Latency is low.Memory usage is stable.Health checks are green.
Then two days later:
• Database CPU spikes• Requests start timing out• Logs show QueuePool limit reached• Restarting pods “fixes” it…...
logiclooptech.dev4 min read