Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-646

C++ driver does not connect to replica sets when all members specified

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • legacy-1.0.6
    • Affects Version/s: legacy-1.0.3
    • Component/s: API
    • Labels:

      We're upgrading from 2.x to 3.0.4 and are having difficulty connecting to a fresh 3.0.4 replica set via the C++ 1.0.3 driver. If the connection string contains just a single member of the set, connection/auth works perfectly, but if all replica set members are specified, auth fails. Using either mongo::DBClientReplicaSet or mongo::ConnectionString::connect results in the same failure behavior.

      When multiple members of a set are specified, the driver does not detect that it's connecting to a Mongo 3 instance, and will attempt to use MONGO-CR instead of SCRAM-SHA1. Tracing through the client code, the client is setting its minimum and maximum wireline versions to (0,0) instead of (0,3) when connecting to the 3.0.4 replica set, which then causes it to default to MONGO-CR as its authentication mechanism. If we add code to detect the wireline version after making a connection (as is done by the driver when connecting to a single machine), the authentication type is set correctly and authentication succeeds.

      Are we doing something wrong or is this a defect in the driver? FWIW, connecting to the same replica sets with the Python driver works as expected when all members are listed...

      A test executable is attached. To build, update the property sheets with the correct locations for boost, mongo, openssl, and gmock. Enable one of the two test methods DISABLED_TestConnectionReplicaSetAuth or DISABLED_TestConnectionReplicaSetConnectionStringAuth to reproduce the issue.

            Assignee:
            adam.midvidy Adam Midvidy
            Reporter:
            sga Steve Ahlgren
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: