mongoose: MongoError: no mongos proxy available, after upgrading from 4.1.2 to 4.4.6

After upgrading from 4.1.2 to 4.4.6 we are randomly getting MongoError: no mongos proxy available. Downgrading to 4.1.2 makes it work stable.

MongoDB cluster with 6 shards (Primary/Secondary/Arbiter each), 2 mongos and 3 config servers MongoDB v3.0.9 Node.js v0.10.24

Options

    options.server = {
      auto_reconnect: true,
      poolSize: 5,
      socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 },
      reconnectTries: 3000
    };
    options.replset = {
      auto_reconnect: true,
      poolSize: 5,
      socketOptions: { keepAlive: 1, connectTimeoutMS : 30000 },
      reconnectTries: 3000
    };
    options.mongos = true;

The connection string is something like this:

var uri = "mongodb://mongodb-streaming-mongos01.mymongo.com:15000,mongodb-streaming-mongos02.mymongo.com:15000/dbname";
var db = mongoose.createConnection(uri, options);

Stack trace

MongoError: no mongos proxy available
MongoError: no mongos proxy available
at [object Object].State.pickServer (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js:192:33)
at [object Object].Mongos.command (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js:595:33)
at [object Object].Mongos.command (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/lib/mongos.js:342:17)
at executeCommand (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/lib/db.js:298:19)
at [object Object].Db.command (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/lib/db.js:322:44)
at [object Object].wrapped (/data/home/socialb/node_modules/newrelic/lib/instrumentation/mongodb.js:185:25)
at count (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/lib/collection.js:1963:13)
at [object Object].Collection.count (/data/home/socialb/node_modules/mongoose/node_modules/mongodb/lib/collection.js:1923:44)
at [object Object].wrapped (/data/home/socialb/node_modules/newrelic/lib/transaction/tracer/index.js:155:28)
at [object Object].wrappedQuery (/data/home/socialb/node_modules/newrelic/lib/instrumentation/mongodb.js:218:53)
at [object Object].wrapped [as count] (/data/home/socialb/node_modules/newrelic/lib/instrumentation/mongodb.js:188:22)
at NativeCollection.(anonymous function) [as count] (/data/home/socialb/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:124:26)
at NodeCollection.count (/data/home/socialb/node_modules/mongoose/node_modules/mquery/lib/collection/node.js:46:19)
at Query._count (/data/home/socialb/node_modules/mongoose/lib/query.js:1276:20)
at /data/home/socialb/node_modules/mongoose/node_modules/kareem/index.js:156:8
at /data/home/socialb/node_modules/mongoose/node_modules/kareem/index.js:18:7
at wrapped (/data/home/socialb/node_modules/newrelic/lib/transaction/tracer/index.js:155:28)
at process._tickDomainCallback (node.js:459:13)
at process.wrappedFunction (/data/home/socialb/node_modules/newrelic/lib/transaction/tracer/index.js:245:51)

Given the complexity of the topology and the random nature of the error we can’t provide a test case.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 15

Most upvoted comments

mongodb-core issue: https://github.com/christkv/mongodb-core/issues/88 A new version was just released which should in theory solve this https://github.com/christkv/mongodb-core/commit/2b4ebbbe5ff77af582fca8ef78c7938ce1c9a79d

@vkarpov15 would you like a pull request to update the mongodb-core version that mongoose depends on?