Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1156

Mongosh does not understand FQDN

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: 1.1.9
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Kubernetes cluster
      DNS configured with `ndots: 5`
    • Not Needed

      Problem Statement/Rationale

      Connecting to an existing atlas instance from our prod k8s cluster, takes a long time ~60s (compared to other environments where it takes ~1s). The cluster is configured with DNS with `ndots: 5`. Further, all requests are also slow. A fix would be for the requests to take ~1s.

      NOTE: These slow requests are not doing any computation;

      Steps to Reproduce

      Have a k8s cluster; where DNS is configured with `ndots: 5` and attempt to connect via mongosh

      Expected Results

      What do you expect to happen?

      Actual Results

      Slow (60s) connection, request time.

      Additional Notes

      Here is summary of what is going on and my hypothesis for where the issue lies.

      The k8s cluster that we are attempting to connect to our atlas instance from has the dns configured with ndots: 5, i.e. either the name is a FQDN (indicated by a trailing .).
      Otherwise, it attempts to resolve multiple local names (i.e. with the k8s cluster name suffix) before trying the actual name.
      These resolutions to non-existent hosts take a long time overall, and seem to slowdown each request.
      Specifically connecting from my dev machine to the atlas instance takes ~1s; while from the k8s cluster takes ~60s.
      It seems that the trailing dot should indicate a fqdn, and avoid unnecessary lookups.
      However, when attempting, e.g. `mongosh "mongodb://clustername-shard-00-00.xyzab.mongodb.net.:27017,mongodb://clustername-shard-00-01.xyzab.mongodb.net.:27017,mongodb://clustername-shard-00-02.xyzab.mongodb.net.:27017/myFirstDatabase?replicaSet=atlas-abcdef-shard-0" --ssl --authenticationDatabase admin`

      It still takes a long time, since from the network trace, it attempts to connect to other endpoints like the replicaset endpoint e.g. `atlas-fi8zuk-shard-0.wgshq.mongodb.net, which is a path that is internally generated, and isn't a fqdn, so triggers a series of local lookups.

      When I attempt the other path style, e.g. mongosh "mongodb+srv://clustername.abcdef.mongodb.net./my-server"; it doesn't even resolve
      the path and returns Server record does not share hostname with parent URI.

      This seems to indicate an issue with mongosh client logic, and how it constructs the internal paths, i.e. it doesn't construct them as FQDNs. This could be mitigated by a flag that forces fqdns. 

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            spandan.bemby@doordash.com Spandan Bemby
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: