-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.5.5
-
Component/s: None
-
Empty show more show less
We are using MongoDB atlas in our node application.
We first started seeing the server selection timeout issue in November 2019 and it was fixed in version 3.3.4 Ticket : NODE-2249
Then we didn't see the issue for like 3-4 months but again in April 2020 we started seeing the same issue and it was fixed in 3.5.5 NODE-2467
After that, starting 3 May we are again experiencing the same issue. Here is the error stack trace.
MongooseServerSelectionError: Server selection timed out after 30000 ms at new MongooseServerSelectionError (/app/node_modules/mongoose/lib/error/serverSelection.js:22:11) at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:823:32) at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:333:15) at Database.db_connect (/app/database/mongoose.js:14:38) at new Database (/app/database/mongoose.js:9:10) at Object.<anonymous> (/app/database/mongoose.js:23:18) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/app/server.js:6:1) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Please note : If we redeploy the application or restart the service then issue is resolved temporarily.
Mongoose version : v5.9.5
MongoDB version (as used by mongoose ): v.3.5.5
Here is the result of db.isMaster() query:
{ "hosts" : [ "lnc-saas-prod-shard-00-00-d8efw.gcp.mongodb.net:27017", "lnc-saas-prod-shard-00-01-d8efw.gcp.mongodb.net:27017", "lnc-saas-prod-shard-00-02-d8efw.gcp.mongodb.net:27017" ], "setName" : "LNC-SaaS-PROD-shard-0", "setVersion" : 2, "ismaster" : true, "secondary" : false, "primary" : "lnc-saas-prod-shard-00-00-d8efw.gcp.mongodb.net:27017", "tags" : { "region" : "CENTRAL_US", "provider" : "GCP", "nodeType" : "ELECTABLE" }, "me" : "lnc-saas-prod-shard-00-00-d8efw.gcp.mongodb.net:27017", "electionId" : ObjectId("7fffffff000000000000000d"), "lastWrite" : { "opTime" : { "ts" : Timestamp(1588685494, 2), "t" : 13 }, "lastWriteDate" : ISODate("2020-05-05T13:31:34Z"), "majorityOpTime" : { "ts" : Timestamp(1588685494, 2), "t" : 13 }, "majorityWriteDate" : ISODate("2020-05-05T13:31:34Z") }, "maxBsonObjectSize" : 16777216, "maxMessageSizeBytes" : 48000000, "maxWriteBatchSize" : 100000, "localTime" : ISODate("2020-05-05T13:31:36.112Z"), "logicalSessionTimeoutMinutes" : 30, "minWireVersion" : 0, "maxWireVersion" : 7, "readOnly" : false, "ok" : 1, "operationTime" : Timestamp(1588685494, 2), "$clusterTime" : { "clusterTime" : Timestamp(1588685494, 2), "signature" : { "hash" : BinData(0,"9FDzNNxXpox7+6HW629It7NKzoU="), "keyId" : 6761765291258020000 } } }