[COMPASS-4768] Driver does not consult OS DNS APIs when resolving SRV/TXT/CNAME Created: 23/Apr/21  Updated: 29/Oct/23  Resolved: 19/Jan/22

Status: Closed
Project: Compass
Component/s: Connectivity
Affects Version/s: 1.26.1
Fix Version/s: 1.31.0

Type: Bug Priority: Major - P3
Reporter: Anna Henningsen Assignee: Anna Henningsen
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MONGOSH-733 Driver does not consult OS DNS APIs w... Closed
Depends
depends on MONGOSH-819 Load balancer support in resolve-mong... Closed
Related
Documentation Changes: Not Needed
Sprint: Iteration Seoul

 Description   

The Node.js driver uses different DNS resolution mechanisms for different situations.

For establishing connections to servers, it does not provide an explicit DNS lookup mechanism, so Node.js uses its default of dns.lookup(). dns.lookup() is an API that forwards requests to the OS DNS APIs.

For resolving mongodb+srv:// URLs (and kerberos hostnames), the driver uses the dns.resolve* family of methods. These methods always send actual UDP packets to DNS servers, which are recorded through an OS API the first time the driver is loaded.

This has some implications for devtools connectivity. In particular, when performing UDP-based communication with the DNS servers in question is not possible, which can happen In VPN environments, the driver is unable to resolve mongodb+srv:// URLs.

Consequently, we probably need a way to customize the driver’s DNS resolution behavior. This could happen by replacing methods on the dns module, for example, or by adding driver options to override the DNS methods used by the driver, or by spinning up a temporary, in-process DNS server that we then tell Node.js to talk to by passing it to dns.setServers() (this last option is probably quite involved, but would not require changes on the driver side or monkey-patching Node.js APIs).

Any approach that emulates what e.g. the `mongo` legacy shell, or other, non-Node.js-based tools do, will have to involve native code, whether as an addon, or as a separate executable.



 Comments   
Comment by Githook User [ 26/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh (#2683)

  • chore(data-service): share connection logic with mongosh

This addresses:

  • fixup: lint
  • chore: Package os-dns-native with Compass COMPASS-4768 (#2688)
  • chore: Externalize os-dns-native package
  • fix(connection-model): Add missing dependency
  • fixup: bump versions to fix compilation, adjust tests
  • fixup: add e2e test for SRV resolutions
  • fixup: adjust rebuild for karma in compass-connect

Co-authored-by: Sergey <petushkov.sergey@gmail.com>
Branch: 1.31-releases
https://github.com/mongodb-js/compass/commit/c5616bc998f459751c573f55be7295c4b16cf21d

Comment by Githook User [ 21/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh (#2683)

  • chore(data-service): share connection logic with mongosh

This addresses:

  • fixup: lint
  • chore: Package os-dns-native with Compass COMPASS-4768 (#2688)
  • chore: Externalize os-dns-native package
  • fix(connection-model): Add missing dependency
  • fixup: bump versions to fix compilation, adjust tests
  • fixup: add e2e test for SRV resolutions
  • fixup: adjust rebuild for karma in compass-connect

Co-authored-by: Sergey <petushkov.sergey@gmail.com>
Branch: COMPASS-5409-create-store
https://github.com/mongodb-js/compass/commit/c5616bc998f459751c573f55be7295c4b16cf21d

Comment by Githook User [ 19/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh (#2683)

  • chore(data-service): share connection logic with mongosh

This addresses:

  • fixup: lint
  • chore: Package os-dns-native with Compass COMPASS-4768 (#2688)
  • chore: Externalize os-dns-native package
  • fix(connection-model): Add missing dependency
  • fixup: bump versions to fix compilation, adjust tests
  • fixup: add e2e test for SRV resolutions
  • fixup: adjust rebuild for karma in compass-connect

Co-authored-by: Sergey <petushkov.sergey@gmail.com>
Branch: COMPASS-5277-add-favorite-dialog
https://github.com/mongodb-js/compass/commit/c5616bc998f459751c573f55be7295c4b16cf21d

Comment by Githook User [ 19/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh (#2683)

  • chore(data-service): share connection logic with mongosh

This addresses:

  • fixup: lint
  • chore: Package os-dns-native with Compass COMPASS-4768 (#2688)
  • chore: Externalize os-dns-native package
  • fix(connection-model): Add missing dependency
  • fixup: bump versions to fix compilation, adjust tests
  • fixup: add e2e test for SRV resolutions
  • fixup: adjust rebuild for karma in compass-connect

Co-authored-by: Sergey <petushkov.sergey@gmail.com>
Branch: port-to-wdio
https://github.com/mongodb-js/compass/commit/c5616bc998f459751c573f55be7295c4b16cf21d

Comment by Githook User [ 19/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh (#2683)

  • chore(data-service): share connection logic with mongosh

This addresses:

  • fixup: lint
  • chore: Package os-dns-native with Compass COMPASS-4768 (#2688)
  • chore: Externalize os-dns-native package
  • fix(connection-model): Add missing dependency
  • fixup: bump versions to fix compilation, adjust tests
  • fixup: add e2e test for SRV resolutions
  • fixup: adjust rebuild for karma in compass-connect

Co-authored-by: Sergey <petushkov.sergey@gmail.com>
Branch: main
https://github.com/mongodb-js/compass/commit/c5616bc998f459751c573f55be7295c4b16cf21d

Comment by Githook User [ 18/Jan/22 ]

Author:

{'name': 'Sergey', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: chore: Package os-dns-native with Compass COMPASS-4768 (#2688)

  • chore: Externalize os-dns-native package
Comment by Githook User [ 18/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh

This addresses:

This does not address:

Comment by Githook User [ 17/Jan/22 ]

Author:

{'name': 'Sergey', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: chore: Package os-dns-native with Compass COMPASS-4768 (#2688)

  • chore: Externalize os-dns-native package
Comment by Githook User [ 13/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh

This addresses:

This does not address:

Comment by Githook User [ 13/Jan/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: chore(data-service): share connection logic with mongosh

This addresses:

This does not address:

Generated at Wed Feb 07 22:37:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.