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

Setting poolSize to 1 still seems to result in 3 connections

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.10
    • Component/s: Lambda, Native
    • Environment:
      NodeJS v8.11.3

      Setting the connection pool size to 1 seems to still result in at-least 3 connections.  This is problematic in autoscaled and "serverless" environments in which many small instances are created.

      The following options on connect():

      MongoClient.connect(url,{{{ }}

      {{  poolSize:1 }}

      }).then(client =>{{{ }}

      {{  console.log("Success"); }}

      {{  client.close(); }}

      }).catch(err => console.error(err));
      {{  }}
      {{ Result in these logs being shown when debug logs are enabled:}}
      {{  }}
      {{ {{[DEBUG-Connection:98625] 1528928831926 creating connection 0 with options [

      {"host":"dev-public-data-shard-00-00-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ] { type: 'debug',}}}}
      {{ {{ message: 'creating connection 0 with options [

      {"host":"dev-public-data-shard-00-00-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ]',}}}}
      {{ {{ className: 'Connection',}}}}
      {{ {{ pid: 98625,}}}}
      {{ {

      { date: 1528928831926 }

      }}}}
      {{ {{[DEBUG-Connection:98625] 1528928831947 creating connection 1 with options [

      {"host":"dev-public-data-shard-00-01-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ] { type: 'debug',}}}}
      {{ {{ message: 'creating connection 1 with options [

      {"host":"dev-public-data-shard-00-01-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ]',}}}}
      {{ {{ className: 'Connection',}}}}
      {{ {{ pid: 98625,}}}}
      {{ {

      { date: 1528928831947 }

      }}}}
      {{ {{[DEBUG-Connection:98625] 1528928831950 creating connection 2 with options [

      {"host":"dev-public-data-shard-00-02-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ] { type: 'debug',}}}}
      {{ {{ message: 'creating connection 2 with options [

      {"host":"dev-public-data-shard-00-02-axw3m.gcp.mongodb.net","port":27017,"size":1,"keepAlive":true,"keepAliveInitialDelay":300000,"noDelay":true,"connectionTimeout":30000,"socketTimeout":360000,"ssl":true,"ca":null,"crl":null,"cert":null,"rejectUnauthorized":false,"promoteLongs":true,"promoteValues":true,"promoteBuffers":false,"checkServerIdentity":true}

      ]',}}}}
      {{ {{ className: 'Connection',}}}}
      {{ {{ pid: 98625,}}}}
      {{ {

      { date: 1528928831950 }

      }}}}
      {{  }}
      {{ This seems to suggest 3 connections are being created.  Is this the case?  And if so, is there a way to limit the actual connections to 1?}}

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            jasonpolites Jason Polites
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: