Acquisition can fail while the database is quiet
A connection-pool leak occurs when application code borrows a connection and fails to return ownership, reducing capacity available to later requests. The database may have finished executing its query while the pool still regards the connection as checked out. This differs from merely having many connections. Track acquisition and return together with borrowing duration. Legitimately long work, database lock waits and an undersized pool can also cause acquisition timeouts, so diagnosis should not label every queue of waiting clients as a leak.
Borrowed connections stop returning
Consider a pool with a maximum of twenty connections. An exception path forgets to return five borrowed connections, leaving fifteen available for ordinary work under the same conditions. Continued leaking can prevent capacity from recovering even after user traffic falls. Those numbers are a capacity illustration, not production measurements. Correlate borrowing start times with completed application requests to find ownership that survives its intended scope. This gives stronger evidence than a single snapshot taken during a traffic burst, when a fully healthy pool may temporarily have no idle connections.
Active queries and borrowed connections differ
Observe checked-out and idle counts, pending borrowers, acquisition latency, borrowing duration and returns on the application side. Compare them with database session state. An idle database session is not necessarily an idle pooled connection: the application can still hold it. Conversely, a long-borrow warning does not prove a leak if the associated operation is expected to run for that duration. Treat the pool’s leak-detection feature as an investigative pointer. Follow the reported acquisition path through success, exception and cancellation handling to establish who is responsible for returning the resource.
Return ownership on every path
Use a structured scope, finally block or try-with-resources pattern so that every completion path returns ownership. Check the particular pool’s contract: closing a proxy connection commonly returns it to the pool, which differs from assuming that every close physically disconnects from the server. Increasing the pool maximum does not repair missing returns and can overload the database. Forced reclamation may interrupt legitimate work and requires an explicit operational policy. After the repair, exercise failure and cancellation paths and confirm that the checked-out count returns to its expected baseline when the work finishes.