Repository navigation
Description
🤖
Describe the bug
Please verify that acquisitions interrupted by ChannelDbConnectionPool shutdown report shutdown rather than a pool timeout, and correct any paths that misclassify the failure.
This is a focused follow-up to #4714. PR #4718 addresses the wait-handle pool only.
Current evidence: ChannelDbConnectionPool.GetInternalConnection already catches ChannelClosedException and throws InvalidOperationException with SQL_ConnectionPoolShutDown: “The connection pool has been shut down.” Its OperationCanceledException handler reports ADP.PooledOpenTimeout(). A channel-pool timeout misclassification has not yet been reproduced.
Source: ChannelDbConnectionPool.cs.
To reproduce
No confirmed channel-specific repro yet. Please add deterministic coverage with Switch.Microsoft.Data.SqlClient.UseConnectionPoolV2 enabled:
- Hold all available pool capacity and park another acquisition.
- Call
ClearPoolorClearAllPoolsbefore its connection timeout expires. - Verify the acquisition reports shutdown, not a pool timeout.
Cover both Open and OpenAsync, including shutdown while an async acquisition is scheduled but has not started. Keep separate coverage for genuine timeout expiration and caller cancellation.
The workload in #4714 can also guide investigation with the channel-pool switch enabled.
Expected behavior
- Shutdown-interrupted acquisitions report the existing shutdown-specific error rather than suggesting pool exhaustion or an elapsed timeout.
- Genuine timeouts retain their timeout error.
- Caller cancellation retains its existing behavior.
If all relevant paths already behave correctly, add regression coverage and document that finding rather than changing the error handling unnecessarily.
Further technical details
Microsoft.Data.SqlClient version: current source at 153f8793e6672816ce6a0652fdae4ea21708b5ad; affected released versions not established.
.NET target: not yet reproduced.
SQL Server version: not yet reproduced.
Operating system: not yet reproduced.
Additional context
Scope is error classification and regression coverage only. Allowing admitted channel-pool acquisitions to finish after shutdown, adding replacement-pool retries, and redesigning channel lifetime are out of scope.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
github-actions commentedon Sep 22, 2026
🔍 Triage Summary
Area\Connection PoolingOpenAsyncreportingTimeout expiredinstead of shutdown whenClearAllPools()/ClearPool()runs). This issue narrows that investigation to theChannelDbConnectionPool(Switch.Microsoft.Data.SqlClient.UseConnectionPoolV2) path specifically, since PR #4718 only fixed the wait-handle pool.Analysis
This issue asks for verification that
ChannelDbConnectionPoolcorrectly reportsSQL_ConnectionPoolShutDown(not a timeout) when an in-flight acquisition is interrupted byClearPool/ClearAllPools, mirroring the fix already applied to the wait-handle pool in #4718. The reporter notes the existingChannelClosedException/OperationCanceledExceptionhandling inChannelDbConnectionPool.GetInternalConnectionlooks correct on inspection, but no channel-pool-specific repro has been confirmed yet — so this is investigation + regression-test work, not a confirmed defect. Likely affected component:ConnectionPool/ChannelDbConnectionPool.cs. Severity: P2 (narrow, well-scoped follow-up to a known regression area; channel pool is opt-in via an AppContext switch, limiting blast radius).Next Steps
ChannelDbConnectionPoolwithSwitch.Microsoft.Data.SqlClient.UseConnectionPoolV2enabled, covering: (1)OpenandOpenAsyncacquisitions in-flight duringClearPool/ClearAllPools, (2) shutdown while an async acquisition is scheduled but not yet started, and (3) confirming genuine timeout and caller-cancellation paths are unaffected — per the exact scenarios called out in the issue body.ChannelClosedException/OperationCanceledExceptionhandling inGetInternalConnection(lines ~1593-1605) is confirmed correct under test, add the regression coverage and close as "verified, no code change needed" rather than altering error handling speculatively.