Database Connection Leak - Connections Never Close
Database connections accumulate over time. Pool reaches max connections and new queries fail. Eventually app becomes completely unresponsive.
Connection count grows with each request and never decreases.
Error Messages You Might See
Common Causes
- Not awaiting database queries properly
- Promise not being resolved/rejected
- Connection created but not returned to pool
- Long-running queries holding connections indefinitely
- Error in query handler not releasing connection
How to Fix It
Always await database calls: await prisma.user.findUnique(...)
Use try/finally to ensure cleanup: try { await db.query(...) } finally { await client.release() }
Set query timeout: Prisma has built-in, use setTimeout for others
Check connection pool size: should be reasonable for concurrent users
Monitor connections: SELECT count(*) FROM pg_stat_activity in PostgreSQL
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
How do I check active connections?
PostgreSQL: SELECT count(*) FROM pg_stat_activity. Should be < max_connections setting
What's a good connection pool size?
Prisma default is 5. Increase for more concurrent users, but don't exceed database limit
Why do connections leak?
Not awaiting promise, error thrown before release, or forgetting to return connection to pool