Repository navigation
Description
Captured from a discussion with a support engineer.
Is your feature request related to a problem? Please describe.
When an application uses connection pooling and is running at the pool's capacity (max connections), there are instances where the error from the connection pool can hide the underlying cause of a failure to obtain a connection from the pool.
Obtaining a connection from the pool is done in the context of a timeout. If the request times out, the pool throws a PooledOpenTimeout exception: The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. This error could be because they are truly using all the pool slots. It could also be that their application is "leaking" connections (not properly closing/disposing connection objects or calling thread abort, which results in an orphaned connection object) and hitting max connections.
Other types of failures may occur due to connection errors like TCP remote host refused the connection. These types of failures can be hidden because retries during the timeout effectively hide the exceptions until the timeout error is thrown. These failures comprise a majority of the support cases that come in for the timeout error. The aspect that makes these painful is that SqlClient isn't capturing and surfacing the inner exception from the connection failure. It takes a memory dump at just the right time to get those details. If it could include the last connection exception as an inner exception on the PooledOpenTimeout exception, it would make connectivity troubleshooting significantly easier in these scenarios.
Describe the solution you'd like
During connection creation in a connection pool, capture the last connection exception (if a physical connection attempt was made) and surface that as the inner exception on PooledOpenTimeout if timeout occurs before a successful connection is made.
Alternatively, something like paulmedynski proposed below:
It might make sense for connection open retries to capture a list of all of the transient failures, and if the open ultimately fails (for a permanent error or timeout), provide the list of transient errors. A sort of ledger of what happened behind the Open() call to help diagnose failures.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn progress
Activity
paulmedynski commentedon Aug 8, 2025
It might make sense for connection open retries to capture a list of all of the transient failures, and if the open ultimately fails (for a permanent error or timeout), provide the list of transient errors. A sort of ledger of what happened behind the Open() call to help diagnose failures.
Add pool tracing/metrics parity and surface pooled-open timeout cause
priyankatiwari08 commentedon Sep 17, 2026
/triage
github-actions commentedon Sep 17, 2026
🔍 Triage Summary (on-demand re-triage)
Area\Connection PoolingAnalysis
This is a feature request to improve diagnosability when a connection pool request fails (e.g.
PooledOpenTimeout) by surfacing the last underlying connection exception (or a ledger of transient failures) as an inner exception, rather than only the generic timeout message. This affectsDbConnectionPool/ChannelDbConnectionPooland connection-open retry logic. The issue is already labeledApprovedand has an open linked pull request, #4590 ("Improve connection pool failure diagnostics"), which appears to implement this proposal. Severity: P2 (diagnostics/usability improvement, not a functional defect).Next Steps
ManualTests/FunctionalTestsfor the new inner-exception behavior on bothChannelDbConnectionPoolandWaitHandleDbConnectionPoolpaths, and for both sync and async open paths.