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

Connection leaking on Secondary server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.19
    • Affects Version/s: 2.1.19
    • Component/s: None
    • Labels:
    • Environment:
      Ubuntu Server 14.04 LTS (HVM)
      Node version 4.4.3
      Driver version 2.1.18

      Mongod version 3.0.x

      We are finding that the number of connections to the Secondary will seemingly grow without bound over time, while the connections on the Primary will stay relatively constant.

      The code below should reproduce this issue:

      var mongodb = require("mongodb");
       
      var uri = "mongodb://admin:admin@localhost:27017,localhost:27018/admin";
      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);
      

      Active connection counts are being gleaned from the mongod logs.

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

              Created:
              Updated:
              Resolved: