-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
Summary
When iterating through the hello response, mongoc_server_description_handle_hello does not set the bson_error_t on the server description if the type check on any fields fails. This causes further errors down the line due to _cluster_fetch_stream_single returning the server description's error if it selects a server with a type of MONGOC_SERVER_UNKNOWN. Since this error is not set, any operation that calls fails with an unknown error.
Environment
Versions starting with 1.22.0 are affected when connecting to a mongohoused. In my case, connecting to mongohoused returned a hello response which contained a connectionId with type int64, whereas libmongoc expects int32 for a connectionId.
How to Reproduce
The hello response that triggered this behaviour is as follows:
{ "ok" : { "$numberInt" : "1" }, "ismaster" : true, "maxBsonObjectSize" : { "$numberInt" : "16777216" }, "maxMessageSizeBytes" : { "$numberInt" : "48000000" }, "maxWriteBatchSize" : { "$numberInt" : "100000" }, "logicalSessionTimeoutMinutes" : { "$numberInt" : "30" }, "connectionId" : { "$numberLong" : "565160423" }, "minWireVersion" : { "$numberInt" : "0" }, "maxWireVersion" : { "$numberInt" : "15" }, "readOnly" : false }
Expected behaviour
When setting the server description's type to unknown, the associated bson_error_t should contain a reason for why the server was marked as unknown. This is not the case for validation failures in the hello response.
- is duplicated by
-
CDRIVER-4360 Improve server description's hello handling
- Closed
- related to
-
CDRIVER-4502 libmongoc expects connectionId in hello response to be int32
- Closed
- links to