-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
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.
- is cloned by
-
NODE-6448 Add CSOT support for client.connect
- Backlog
- is duplicated by
-
NODE-6250 Migrate connecting logic to server selection
- Closed
- is related to
-
NODE-6273 Add support for CSOT with auto connection
- Closed
- related to
-
NODE-5682 Add CSOT support for socket read/write at the connection layer for CRUD APIs (not including cursors)
- Closed