-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 2.1.6
-
Component/s: MongoDB 3.2
-
Environment:Debian 8 + Nodejs 4.2.6
Hi,
To reproduce the problem I used this simple code:
var MongoClient = require('mongodb').MongoClient , f = require('util').format; MongoClient.connect('mongodb://localhost:27017/test', {db: {native_parser: true, bufferMaxEntries: -1}, server: { poolSize: 20, socketOptions: {autoReconnect: true, keepAlive: 50}, reconnectTries : 1000, reconnectInterval : 1000 }}, function(err, db) { var col = db.collection('t'); var count = 1; setInterval(function() { col.insertOne({a:1, count: count}, function(err, r) { console.log("insert", count) console.log(err); count = count + 1; col.findOne({}, function(err, doc) { console.log("findOne") console.log(err) }); }) }, 2000) });
If you stop the mongodb server, wait a few seconds and start the mongodb server again it will reconnect but only the first time. If you repeat this operations again it will not reconnect.
however no issue if
1) restart mongodb (so you must wait a few seconds before stop and start to see the problem).
2) set bufferMaxEntries to 0
Thanks!