All challenges
Code AnalysisIntermediate 60s

Connection pool exhaustion from leaked connections

Under load the app hangs with 'pool exhausted'. Root cause?
Starter code
conn = pool.acquire()
try:
    result = conn.query(sql)
    return transform(result)
except Exception:
    log.exception()
    raise
# conn.close() never called

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle