Skip to content

DRIVERS-2884: CSOT avoid connection churn when operations timeout#1845

Open
sanych-sun wants to merge 14 commits into
mongodb:masterfrom
sanych-sun:DRIVERS-2884
Open

DRIVERS-2884: CSOT avoid connection churn when operations timeout#1845
sanych-sun wants to merge 14 commits into
mongodb:masterfrom
sanych-sun:DRIVERS-2884

Conversation

@sanych-sun
Copy link
Copy Markdown
Member

@sanych-sun sanych-sun commented Sep 26, 2025

This PR is based on the Preston's work in another PR that was closed by mistake: #1675

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 connection to be attempted during the connection check out from the pool.
Each pending response draining 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.

This update introduces new CMAP events and logging messages (PendingResponseStarted, PendingResponseSucceeded, PendingResponseFailed) to improve observability of this path.

Please complete the following before merging:

  • Update changelog.
  • Test changes in at least one language driver (CSharp Driver implementation PR).
  • Test these changes against all server versions and topologies (including standalone, replica set, and sharded
    clusters).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants