Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-517

Lazily-connected MongoClient with wrong password raises AutoReconnect instead of OperationFailure

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6
    • Affects Version/s: 2.5.1
    • Component/s: None
    • None

      Initialize an unconnected MongoClient with the wrong password, then do an operation that triggers it to connect and authenticate:

      c = MongoClient(
          "mongodb://user:wrong@%s:%d/pymongo_test" % (host, port),
          _connect=False)
      
      c.pymongo_test.test.find_one()
      

      Expected: OperationFailure. Actual: AutoReconnect.

      MongoReplicaSetClient handles this case correctly.

      I revealed this bug in the process of fixing PYTHON-516. The fix is moderate-risk, low-reward, so I'm putting it off until PyMongo 2.6.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: