-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: CSOT
Use Case
Currently, `topology.selectServer` instantiates its own timeout context using `timeoutMS` from the client options when running `ping`. In the case of auto connect, this can result in an operation taking up to operation timeoutMS + client timeoutMS.
User Impact
- Without this CSOT can be inconsistently observed if the operation with a timeoutMS is the connecting operation.
Dependencies
- None
Unknowns
- Our intent is to race connect with a timeout and reject if connect doesn't finish in time.
- Is this a good user experience? timeoutMS for a connected operation vs timeoutMS for an operation that is connecting could be surprisingly different
- timeoutMS is for bounding the operation, auto-connect is a shortcut but not part of the operation
- It is unpleasant when timeoutMS is "unusable" in the sense that it doesn't actually bound the operation
- Should we force users into using MongoClient.connect()
- NB: selectServer should do all the things relating to connect
- What is the risk of allowing connect to continue without awaiting the result?
- Should connect take a new options.timeoutMS API?
- No, because if connect were to support timeoutMS directly then it would need to be better than a race with a timeout to account for squashing errors like FS access.
Acceptance Criteria
Implementation Requirements
- timeoutMS will not control auto-connect, users should connect explicitly.
- document the behavior on connect
Testing Requirements
- Unskip tests skipped in
NODE-6092 - Write tests checking duration and rejection scenarios
Documentation Requirements
- Yes, update the API docs on client.connect()
Follow Up Requirements
- None
Notable Not Doing
- Potential implementation - race operation timeout with autoconnect so that if the autoconnect doesn't finish before the timeout, then the operation that triggered the autoconnect will throw a timeout error, but the autoconnect will proceed.
- Determine if this is the desired behavior for CSOT with auto connect.
- Should operation timeoutMS govern auto connect, or should the ping be governed by client timeoutMS?
- If necessary, align the implementation to match the outcome of 1.
- clones
-
NODE-6223 Document the lack of CSOT support MongoClient.connect and auto-connect
- Closed