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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: legacy-1.0.3
    • Fix Version/s: legacy-1.0.6
    • Component/s: API
    • Labels:
    • Sprint:
      Platform 8 08/28/15, Platform 7 08/10/15, Platform 9 (09/18/15), Platform A (10/09/15), Platform B (10/30/15)

      Description

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: