[CDRIVER-3451] Do not block for connectTimeoutMS when connecting if serverSelectionTimeoutMS exceeded for single-threaded client Created: 05/Dec/19  Updated: 31/Mar/22

Status: Backlog
Project: C Driver
Component/s: libmongoc, network, SDAM
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

Currently, attempting to establish a connection to a server will block for connectTimeoutMS, potentially exceeding the overall timeout of serverSelectionTimeoutMS. This causes some surprising behavior. For example the following connection attempt blocks for 5 seconds:

example-client "mongodb://1.1.1.1:12345/?serverSelectionTryOnce=false&serverSelectionTimeoutMS=1000&connectTimeoutMS=5000"

Strictly speaking, this might be compliant with the server selection spec:

Because single-threaded selection can do a blocking immediate check, serverSelectionTimeoutMS is not a hard deadline. The actual maximum server selection time for any given request can vary from serverSelectionTimeoutMS minus minHeartbeatFrequencyMS to serverSelectionTimeoutMS plus the time required for a blocking scan.

But libmongoc does not make a blocking connection, even for single threaded clients, and should be able to cap the timeout of connecting (probably here).


Generated at Wed Feb 07 21:18:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.