-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-5711: Avoid clearing the connection pool when the server connection rate limiter triggers #1838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ction rate limiter triggers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements support for avoiding connection pool clearing when the server connection rate limiter triggers, adding the "SystemOverloadedError" and "RetryableError" labels to network errors during connection establishment or handshake. This allows the driver to apply backpressure instead of unnecessarily clearing the pool.
- Added error label support to identify rate limiter backpressure scenarios
- Modified pool clearing logic to skip clearing when SystemOverloadedError is present
- Updated test specifications to reflect the new behavior
Reviewed changes
Copilot reviewed 75 out of 75 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/MongoDB.Driver/Core/Connections/BinaryConnection.cs | Adds backpressure error labels to network errors during connection establishment/handshake |
| src/MongoDB.Driver/Core/Servers/DefaultServer.cs | Prevents pool clearing when SystemOverloadedError label is present |
| src/MongoDB.Driver/Core/Misc/Feature.cs | Adds IngressConnectionEstablishmentRateLimiter feature flag for server version 8.0+ |
| tests/MongoDB.Driver.Tests/Specifications/server-discovery-and-monitoring/prose-tests/ServerDiscoveryProseTests.cs | Adds prose test validating pool isn't cleared during backpressure |
| tests/MongoDB.Driver.Tests/Specifications/connection-monitoring-and-pooling/ConnectionMonitoringAndPoolingTestRunner.cs | Updates test runner to handle interruptInUseConnections parameter |
| tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs | Removes skip exception for previously flaky pool-clear tests |
| specifications/server-discovery-and-monitoring/tests/unified/.yml/.json | Updates schema versions from 1.10 to 1.4 and test descriptions |
| specifications/connection-monitoring-and-pooling/tests/cmap-format/.yml/.json | Renames closeInUseConnections to interruptInUseConnections throughout tests |
| specifications/load-balancers/tests/.yml/.json | Changes test expectations from network errors to server errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // https://github.com/mongodb/specifications/blob/a8d34be0df234365600a9269af5a463f581562fd/source/server-discovery-and-monitoring/server-discovery-and-monitoring-tests.md?plain=1#L176 | ||
| [Theory] | ||
| [ParameterAttributeData] | ||
| public async Task Connection_Pool_Backpressure([Values(true, false)]bool async) |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between parameter attribute and parameter type. Add space after closing bracket of Values attribute.
| public async Task Connection_Pool_Backpressure([Values(true, false)]bool async) | |
| public async Task Connection_Pool_Backpressure([Values(true, false)] bool async) |
No description provided.