Update to Go 1.23 to handle compressed SRV records

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator
    • 350

      Problem Statement/Rationale

      The MongoDB tools like mongodump and mongorestore are unable to handle URIs that start with `mongodb+srv://` if the DNS server applies compression on SRV records.

      Please update the MongoDB tools to Go 1.23 so that everyone can easily access Mongo Atlas no matter what DNS server they are using.

      Steps to Reproduce

      Switch your computer to a DNS server that applies compression to SRV records and try to access a MongoDB Atlas cluster via a `mongodb+srv://` URI.

      Expected Results

      The mongo tools work successfully.

      Actual Results

      Tools like mongodump and mongorestore error out with cryptic messages like the following:

      2024-10-17T14:57:10.088-0500    error parsing command line options: error parsing uri: lookup <redacted>.mongodb.net on 10.3.0.1:53: cannot unmarshal DNS message
      2024-10-17T14:57:10.088-0500    try 'mongodump --help' for more information

      At my office, we use the DNS server built into our MikroTik router.  When mongodump or mongorestore try to lookup up the seed list, it provides a DNS response to the DNS SRV request.  Wireshark shows that the SRV records in the response are compressed.  Specifically, only the first response is complete in the hex view, while the other responses only have the first part of the host name, followed by a pointer (2-byte hex sequence typically "c0 xx" ) back to the first record.

      After changing my computer to a different DNS server that does not apply compression to SRV records (e.g. Google's 8.8.8.8), the mongo tools work successfully.

      Additional Notes

      Here is my computer information, although it seems unlikely to be much help with this issue:

      Intel MacBook Pro (2018)
      macOS Ventura 13.6.9

      I installed the latest version of the mongotools using Homebrew.  Here is the output of "mongorestore --version".

      mongorestore version: 100.9.5
      git version: 90481484c1783826fe26ca18bbdcd30e933f3b88
      Go version: go1.21.11
         os: darwin
         arch: amd64
         compiler: gc

      For several years, Go has been unable to handle DNS SRV records if the DNS server applied compression to these records.  This has finally been fixed in Go 1.23 (see https://github.com/golang/go/issues/36718 ).  In case you are really interested, here's the full history of the compressed SRV records debate:

      It appears that several others have also run into this issue over the years:

            Assignee:
            Unassigned
            Reporter:
            Matt Knutson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: