-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
None
When a stream is fetched for an operation, libmongoc fetches the server description from the topology description and uses that metadata for wire version checks, checking for supported compression.
This is explicitly discouraged by SDAM's Warning about the maxWireVersion from a monitor's ismaster response and may make the driver susceptible to racy comparisons. For example:
1. Thread 1 runs an insert. This creates a stream, performs a handshake, creates a
cluster node, and proceeds to insert.
2. Later, thread 1 begins another insert operation. It selects the primary, but just before it calls _mongoc_cluster_stream_for_server...
3. Thread 2 runs an insert, gets a network error, and marks the server as Unknown.
4. Thread 1 continues, and creates a server stream with an Unknown server description. Any wire version checks it does will check with wire version 0.
We've seen bugs of this type before, example: CDRIVER-3404.
It seems like there was at least some intention to fix this at some point. mongoc_cluster_node_t has its own copies of max_wire_version, min_wire_version, max_write_batch_size, max_bson_obj_size, and max_msg_size. But those fields are unused.
- is depended on by
-
PHPC-1979 Use mongoc_client_get_handshake_description for LoadBalancer server types
- Closed
-
PHPC-1926 Utilize mongoc_client_get_handshake_description for ServerDescription
- Closed
- is duplicated by
-
CDRIVER-3475 Determine wire version and size limits from socket's ismaster, not server description
- Closed
- is related to
-
NODE-4853 Retryability eligibility should be determined from initial hellos on each connection
- Backlog
- related to
-
CDRIVER-4077 OP_KILLCURSORS incorrectly used to destroy change stream during resume attempt
- Backlog
-
CDRIVER-3563 Cursor may use an invalidated server description
- Closed