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

Pymongo failed to query TXT records of Atlas while ndots is configured

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Connection String
    • None

      Problem Statement/Rationale

      Connecting to an existing atlas instance from our k8s cluster failed and thrown AuthenticationFailed exception.

      Steps to Reproduce

      Have a k8s cluster; where DNS is configured with ndots: 5 and attempt to connect it using pymongo and dnspython2.

      Expected Results

      It should be able to connect to the atlas instance.

      Actual Results

      It fails with AuthenticationFailed exception as the TXT record is not found and connection string is not parsed.

      Additional Notes

      After checking, I noticed that PyMongo / DNSPython only tried the first possible QNAME which includes the search domain. It should try all possible QNAMEs.

      Here's the QNAMEs that it tried:

       

      [<DNS name REDACTED-staging.REACTED.mongodb.net.NAMESPACE.svc.cluster.local.>, <DNS name REDACTED-staging.REDACTED.mongodb.net.svc.cluster.local.>, <DNS name REDACTED-staging.REDACTED.mongodb.net.cluster.local.>, <DNS name REDACTED-staging.REDACTED.mongodb.net.>]

      SRV records resolving should have the same bug. However it contains 5 dots and and DNSPython doesn't try the search domain at first. So it works.

      [<DNS name _mongodb._tcp.REDACTED-staging.REDACTED.mongodb.net.>, <DNS name _mongodb._tcp.REDACTED-staging.REDACTED.mongodb.net.NAMESPACE.svc.cluster.local.>, <DNS name _mongodb._tcp.REDACTED-staging.REDACTED.mongodb.net.svc.cluster.local.>, <DNS name _mongodb._tcp.REDACTED-staging.REDACTED.mongodb.net.cluster.local.>]

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            g@xswan.net Aveline N/A
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: