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

Undefined variable err in pool.js throws Error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 2.1.14
    • Fix Version/s: 2.2.31
    • Component/s: MongoDB 3.2, MongoDB 3.4
    • Labels:
      None
    • Environment:
      Mac OS
      Linux on Docker

      Description

      It seems like a function in pool.js is trying to access an undefined variable err

      pool.js, line 867:

      {{
      while(self.queue.length > 0) {
      var workItem = self.queue.shift();
      if(typeof workItem.cb == 'function')

      { workItem.cb(null, err); }

      }
      }}

      This leads to an unexpected Javascript error when loosing the connection due to timeout settings.

      {{
      node_modules/mongodb-core/lib/connection/pool.js:867
      workItem.cb(null, err);
      ^

      ReferenceError: err is not defined
      at Pool.destroy (/Users/masa/Code/docoyo.trackable/beacontrack.connectors/src/connectors2/node_modules/mongodb-core/lib/connection/pool.js:867:27)
      at Connection.<anonymous> (/Users/masa/Code/docoyo.trackable/beacontrack.connectors/src/connectors2/node_modules/mongodb-core/lib/connection/pool.js:265:14)
      at Connection.g (events.js:292:16)
      at emitTwo (events.js:106:13)
      at Connection.emit (events.js:191:7)
      at Socket.<anonymous> (/Users/masa/Code/docoyo.trackable/beacontrack.connectors/src/connectors2/node_modules/mongodb-core/lib/connection/connection.js:197:10)
      at Socket.g (events.js:292:16)
      at emitNone (events.js:86:13)
      at Socket.emit (events.js:185:7)
      at Socket._onTimeout (net.js:338:8)
      at ontimeout (timers.js:386:14)
      at tryOnTimeout (timers.js:250:5)
      at Timer.listOnTimeout (timers.js:214:5)
      }}

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              matt.broadstone Matt Broadstone
              Reporter:
              masa Masanori Fujita
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: