-
Notifications
You must be signed in to change notification settings - Fork 245
DRIVERS-2884 Avoid connection churn when operations timeout #1675
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: master
Are you sure you want to change the base?
Conversation
source/client-side-operations-timeout/tests/connection-churn.yml
Outdated
Show resolved
Hide resolved
source/client-side-operations-timeout/tests/connection-churn.yml
Outdated
Show resolved
Hide resolved
source/client-side-operations-timeout/tests/connection-churn.yml
Outdated
Show resolved
Hide resolved
source/client-side-operations-timeout/tests/connection-churn.yml
Outdated
Show resolved
Hide resolved
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.
CMAP changes look good to me. Pending Shane's second implementation though.
@@ -53,8 +53,9 @@ An error is considered retryable if it meets any of the following criteria: | |||
| SocketException | 9001 | | |||
|
|||
- a [PoolClearedError](../connection-monitoring-and-pooling/connection-monitoring-and-pooling.md#connection-pool-errors) | |||
- Any of the above retryable errors that occur during a connection handshake (including the authentication step). For | |||
example, a network error or ShutdownInProgress error encountered when running the hello or saslContinue commands. | |||
- Any of the above retryable errors that occur during a connection handshake (including the authentication step) or |
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.
Are drivers without CSOT (currently Rust and C) expected to implement these changes in their retryability behavior as part of this ticket? If so, I think we should add retryability-only tests in this PR or prioritize DRIVERS-3216.
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.
@isabelatkinson I think this update would only be relevant to driver that implement CSOT. Otherwise, the only I/O that occurs during checkout is the connection handshake which have tests prescribed in DRIVERS-746.
For context, this ticket introduces I/O to CMAP to both "drain" the TCP buffer and perform aliveness checks for connections pending response data. The pathological case is the aliveness check which will return an error but preserve the connection if successful and so should retry at the operation layer.
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.
retryability spec changes LGTM. Rust does not have CSOT, so I'm not able to POC/test
This PR implements the design for connection pooling improvements described in DRIVERS-2884, based on the CSOT (Client-Side Operation Timeout) spec. It addresses connection churn caused by network timeouts during operations, especially in environments with low client-side timeouts and high latency.
When a connection is checked out after a network timeout, the driver now attempts to resume and complete reading any pending server response (instead of closing and discarding the connection). This may require multiple checkouts.
Each pending response read is subject to a cumulative 3-second static timeout. The timeout is refreshed after each successful read, acknowledging that progress is being made. If no data is read and the timeout is exceeded, the connection is closed.
To reduce unnecessary latency, if the timeout has expired while the connection was idle in the pool, a non-blocking single-byte read is performed; if no data is available, the connection is closed immediately.
This update introduces new CMAP events and logging messages (PendingResponseStarted, PendingResponseSucceeded, PendingResponseFailed) to improve observability of this path.
Please complete the following before merging:
clusters, and serverless).