-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.1.8
-
Component/s: MongoDB 3.2
-
Environment:using nodejs 5.7.1
-
Empty show more show less
We're seeing lots of connection from a machine which is running 2.1.8. We're connecting to a replicaSet.
MongoClient .connect(mongoUrl, {promiseLibrary: Promise}) .then(adminDb => { adminDb.on('reconnect', () => console.log('reconnect', new Error().stack)) })
When the reconnect logs appear, we see 4 connections being made within a couple of milliseconds.
The stacktrace we're printing is not always the same:
at null.<anonymous> (/opt/myproject/src/mongodb/index.js:35:49) at emitTwo (events.js:100:13) at emit (events.js:185:7) at listener (/opt/myproject/node_modules/mongodb/lib/db.js:1729:14) at emitNone (events.js:80:13) at emit (events.js:179:7) at null.<anonymous> (/opt/myproject/node_modules/mongodb/lib/replset.js:200:10) at emitOne (events.js:90:13) at emit (events.js:182:7) at State.update (/opt/myproject/node_modules/mongodb-core/lib/topologies/replset_state.js:471:20) at /opt/myproject/node_modules/mongodb-core/lib/topologies/replset.js:1146:27 at commandCallback (/opt/myproject/node_modules/mongodb-core/lib/topologies/server.js:945:9) at Callbacks.emit (/opt/myproject/node_modules/mongodb-core/lib/topologies/server.js:116:3) at null.messageHandler (/opt/myproject/node_modules/mongodb-core/lib/topologies/server.js:288:23) at Socket.<anonymous> (/opt/myproject/node_modules/mongodb-core/lib/connection/connection.js:320:20) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7)
or
at null.<anonymous> (/opt/myproject/src/mongodb/index.js:35:49) at emitTwo (events.js:100:13) at emit (events.js:185:7) at listener (/opt/myproject/node_modules/mongodb/lib/db.js:1729:14) at emitNone (events.js:80:13) at emit (events.js:179:7) at null.<anonymous> (/opt/myproject/node_modules/mongodb/lib/replset.js:200:10) at emitOne (events.js:90:13) at emit (events.js:182:7) at State.update (/opt/myproject/node_modules/mongodb-core/lib/topologies/replset_state.js:471:20) at processNewServer (/opt/myproject/node_modules/mongodb-core/lib/topologies/replset.js:1311:27) at null.<anonymous> (/opt/myproject/node_modules/mongodb-core/lib/topologies/replset.js:1364:46) at g (events.js:273:16) at emitOne (events.js:90:13) at emit (events.js:182:7) at /opt/myproject/node_modules/mongodb-core/lib/topologies/server.js:497:23
When I revert to 2.1.4, this is reconnecting doesn't happen. The mongodb primary's connections are stable again.