Details
-
Improvement
-
Resolution: Unresolved
-
Unknown
-
None
-
None
-
None
-
None
Description
Background & Motivation
mongoc_cmd_parts_assemble currently checks if the topology description is load balanced when serializing a command for pre OP_MSG.
This is necessary to prevent an assertion in mongoc_cmd_parts_assemble_mongod. That asserts that the topology type is not load balanced.
In the scenario that the server is not a mongos and is a pre 3.6. _mongoc_cluster_stream_for_server will return an error with the message "Driver attempted to initialize in load balancing mode, but the server does not support this mode" if the server does not report a serviceId. But that error check only occurs after the authentication handshake is attempted.
The check is necessary to avoid the assertion during the authentication handshake. A preferable change would be to check for the presence of serviceId before authentication is attempted. That would preclude mongoc_cmd_parts_assemble from ever being called with a non-mongos server in load balanced mode.
Scope
When in load balanced mode, check for the presence of a serviceId field before authentication occurs and return an error.