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

Connection leaking and authentication issues

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.1.21
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu Server 14.04 LTS (HVM)
      Node version 4.4.3
      Driver version 2.1.21
      mongod version 3.0.11

      Description

      We are finding that the number of connections to the Primary, Secondary, and Arbiter will seemingly grow without bound over time.

      The code below reproduces this issue:

      var mongodb = require("mongodb");
       
      var uri = "mongodb://foo:bar@ds021331-a0.mlab.com:21331,ds021331-a1.mlab.com:21331/driver-test?replicaSet=rs-ds021331";
      var interval = 1000;
       
      var openThenClose = function(){
          var MongoClient = mongodb.MongoClient;
          MongoClient.connect(uri, function(err, db) {
              console.log("open");
              var descriptors = db.collection("some-collection").find();
              descriptors.toArray(function(err, docs){
                  db.close(function(){
                      console.log("close");
                  });
              });
          });
      };
       
      setInterval(function(){
          openThenClose();
      }, interval);
      

      You can test against the deployment in the script. I've also attached the log files for the Primary, Secondary, and Arbiter, which I've cleaned up to make easier to read. Note that they begin at ~2016-05-30T10:31:52.282-0700 and problems start manifesting ~3.5 hours later.

      The Primary and Secondary logs contain the following error message:

      SCRAM-SHA-1 authentication failed for foo on driver-test from client 52.207.222.58 ; BadValue Unmatched SCRAM-SHA-1 nonce received from client in second step, expected i2cVwYAl+bypiy6nm0aX+rF8fiKNL3FYe1FtUQ4lij7r7c3hYkj1J7nwqxl1L4Fa but received

      The Arbiter logs show that the driver is trying to authenticate against the server (which is not intended behavior per https://jira.mongodb.org/browse/NODE-693):

      SCRAM-SHA-1 authentication failed for foo on driver-test from client 52.207.222.58 ; UserNotFound Could not find user foo@driver-test

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              christkv Christian Amor Kvalheim
              Reporter:
              chrischang12 Christopher Chang
              Votes:
              9 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: