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

readPreference of Secondary can cause Node driver to hang

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: MongoDB 3.4
    • Labels:
      None

      When trying to utilize a readPreference of Secondary on a replica set, the Node driver has a chance of intermittently taking forever to run.

      MongoDB: 3.4.6
      Node: 6.10.3
      MongoDB Node Driver: 2.2.30

      I have attached my topology.js that I used for testing as well as the logs from the runs to this ticket.

      I set up a 3.4.6 PSS replica set on my local computer with the ports of 27017, 27018, and 27019. I used the instructions in the Node Quick Start guide to install the MongoDB Node Driver. In order to get increased logging, I utilized the "simple code example" for Topology Monitoring as the basis for my application. The only substantive changes were:

      1. An adjusted connection string.
      2. Timestamp logging to get an idea of how fast the application runs.
      3. A findOne() command against a non-existent collection.

      Between each test, the only thing I changed was the connection string in two different ways:

      1. I changed the name of the hosts. They were either "localhost" or the FQDN of "Hatcher.local". Some runs had only the first hostname as the FQDN with the rest being localhost.
      2. I changed the order of the hosts. The Primary was either the first node listed in the connection string or the last node.

      Hostname Order Approx. Time Logs
      localhost (all) PSS 13ms localhost_Primary.log
      localhost (all) SSP 14ms localhost_Secondary.log
      FQDN (first) PSS 10,016ms hatcher_Primary.log
      FQDN (first) SSP 9ms hatcher_Secondary.log
      FQDN (all) PSS canceled operation after 20 minutes hatcherall_Primary.log
      FQDN (all) SSP 7ms hatcherall_Secondary.log

        1. hatcher_Primary.log
          9 kB
        2. hatcher_Secondary.log
          10 kB
        3. hatcherall_Primary.log
          627 kB
        4. hatcherall_Secondary.log
          7 kB
        5. localhost_Primary.log
          11 kB
        6. localhost_Secondary.log
          11 kB
        7. NODE-1089_Test.js
          2 kB
        8. topology.js
          2 kB

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            daniel.hatcher@mongodb.com Danny Hatcher (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: