Code RoomConnection pool exhausted
MediumPrep Room Coding #2616

Connection pool exhausted

On-callReliability & on-callMid–Senior~30 min

A service starts returning 500s with 'timeout waiting for connection from pool' to its Postgres, climbing slowly over hours after each deploy until it saturates, then a restart resets the clock. DB CPU, slow-query logs, and active-query counts are all normal — the DB is barely busy. The pool max is 20. A recent change added a code path that, on a specific validation error, returns early. Pool 'connections in use' climbs monotonically and never returns to baseline. How do you triage and fix?

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 30 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.