[6.1] Fix connection pool concurrency issue (#3632)#3653
Merged
cheenamalhotra merged 1 commit intorelease/6.1from Oct 6, 2025
Merged
[6.1] Fix connection pool concurrency issue (#3632)#3653cheenamalhotra merged 1 commit intorelease/6.1from
cheenamalhotra merged 1 commit intorelease/6.1from
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a connection pool concurrency issue by improving semaphore handling and includes comprehensive stress tests to validate the fix. It ports the changes from PR #3632 to the release/6.1 branch.
Key Changes
- Refactored semaphore acquisition and release pattern to use RAII-style resource management
- Added comprehensive connection pool stress tests with both synchronous and asynchronous scenarios
- Simplified error handling logic in pool creation requests
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| WaitHandleDbConnectionPool.cs | Introduces SemaphoreHolder class for safe semaphore management and refactors pool creation logic |
| ConnectionPoolStressTest.cs | New comprehensive test class for validating connection pool behavior under concurrent load |
| Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | Adds the new stress test to the project compilation |
...oft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs
Show resolved
Hide resolved
...icrosoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolStressTest.cs
Show resolved
Hide resolved
...icrosoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolStressTest.cs
Show resolved
Hide resolved
paulmedynski
approved these changes
Oct 3, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3653 +/- ##
===============================================
+ Coverage 69.69% 70.06% +0.37%
===============================================
Files 281 279 -2
Lines 62413 61746 -667
===============================================
- Hits 43500 43264 -236
+ Misses 18913 18482 -431
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mdaigle
approved these changes
Oct 3, 2025
This was referenced Oct 8, 2025
Closed
This was referenced Dec 29, 2025
This was referenced Jan 11, 2026
This was referenced Jan 18, 2026
This was referenced Jan 26, 2026
This was referenced Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports #3632 to release/6.1