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

Node Driver Hangs Indefinitely When Connecting Via SRV Record

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 3.0.6
    • 3.0.7
    • None
    • None

    Description

      When connecting to a cluster using a SRV record, the Node driver hangs indefinitely if the read preference is primary and the first SDAM event returns a topology type of ReplicaSetNoPrimary, even though the cluster has a primary and is in a healthy state.

      Steps to reproduce:

      const { MongoClient } = require('mongodb');
      const client = new MongoClient(
       "mongodb+srv://<redacted>/admin?readPreference=primary&appname=MongoDB%20Compass%20Dev&authSource=admin&ssl=true",
       { readPreference: "primary", connectWithNoPrimary: true, checkServerIdentity: true, sslValidate: true }
      );
      client.connect((err, c) => {
        // This block will never get executed.
        console.log('in connected block');
        console.log(err);
        console.log(c);
      });
      

      Switching to primaryPreferred as the read preference will always connect.

      Attachments

        Issue Links

          Activity

            People

              daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
              durran.jordan@mongodb.com Durran Jordan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: