Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4622

Investigate why we cannot connect to IPv6 replicaset with 4.x driver

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.10.0
    • Affects Version/s: 4.0.0, 4.9.1
    • Component/s: None
    • 3
    • Not Needed
    • Not Needed

      What problem are you facing?

      Cannot connect to replica sets configured through IPv6 addresses.

      What driver and relevant dependency versions are you using?

      Happens with 4.0.0 and 4.9.1 driver and various versions in between, but not with latest 3.x.

      Steps to reproduce?

      • Add local replica set mongod configs: https://gist.github.com/addaleax/f404d9762d7d767baead1197a2f06b5e
      • Prepare db: mkdir db1 && mkdir db2 && echo 'mysecretkey' > keyfile && chmod og-rwx keyfile
      • Start servers: mongod --config mongod1.conf && mongod --config mongod2.conf
      • Configure replicaset: mongosh 'mongodb://[::1]:27444/?directConnection=true' --eval 'rs.initiate({_id:"replset", version:1, members: [{_id:0, host:"[::1]:27444"}, {_id:1, host:"[::1]:27445"}]})'
      • Attempt to connect using mongosh, Compass, or Node.js driver: mongosh 'mongodb://[::1]:27444/?directConnection=false'

      This behavior does not vary when providing both rs nodes in the seed list or depending on the ?replicaSet connection string option.

      Note that connecting to individual nodes using ?directConnection=true succeeds.

      Relevant excerpt from a mongosh log:

      {"t":{"$date":"2022-09-08T16:10:35.836Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000042,"ctx":"mongosh-connect","msg":"Initiating connection attempt","attr":{"uri":"mongodb://[::1]:27444/?directConnection=false&appName=mongosh+1.5.4","driver":{"name":"nodejs|mongosh","version":"4.8.1"},"devtoolsConnectVersion":"1.4.3","host":"::1:27444"}}
      {"t":{"$date":"2022-09-08T16:10:35.840Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000035,"ctx":"mongosh-connect","msg":"Server heartbeat succeeded","attr":{"connectionId":"::1:27444"}}
      {"t":{"$date":"2022-09-08T16:10:35.843Z"},"s":"W","c":"DEVTOOLS-CONNECT","id":1000000034,"ctx":"mongosh-connect","msg":"Server heartbeat failure","attr":{"connectionId":"::1:27445","failure":"connection establishment was cancelled","isFailFast":false,"isKnownServer":false}}
      {"t":{"$date":"2022-09-08T16:11:05.854Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000037,"ctx":"mongosh-connect","msg":"Connection attempt finished"}
      

      This is happening on Ubuntu 20.04 Linux.

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: