Postgres pool pinned at capacity
Your task
A Node.js API using a 20-connection Postgres pool starts throwing 'timeout exceeded when trying to acquire a connection' and 'remaining connection slots are reserved' from Postgres at 12:00. The pool's in-use gauge is pinned at 20/20 and never drops, even during a brief traffic lull where QPS halved, used connections stayed at 20. CPU and memory are fine. A feature shipped this morning added a code path that runs a query inside a manual transaction (BEGIN) and, on one early-return error branch, returns without COMMIT/ROLLBACK and without releasing the client. Triage and mitigate.
It covers
- Connection leak
- Db pool
- Uncommitted tx