12

I have Node.js service in which I am using mongo-API to communicate with Document/Cosmos DB. My service run's fine and performs all the crud operation but after 1 min some mongo error throws from the service.

/document-db-service/node_modules/mongodb/lib/utils.js:123
    process.nextTick(function() { throw err; });
                                  ^
MongoError: pool destroyed
    at Pool.write (/document-db-service/node_modules/mongodb-core/lib/connection/pool.js:922:12)
    at Cursor._find (/document-db-service/node_modules/mongodb-core/lib/cursor.js:286:22)
    at nextFunction (/document-db-service/node_modules/mongodb-core/lib/cursor.js:584:10)
    at Cursor.next [as _next] (/document-db-service/node_modules/mongodb-core/lib/cursor.js:692:3)
    at fetchDocs (/document-db-service/node_modules/mongodb/lib/cursor.js:856:10)
    at toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:883:3)
    at Cursor.toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:836:44)
    at exports.getDocsOfCollections (/document-db-service/services/collections.js:273:10)
    at Layer.handle [as handle_request] (/document-db-service/node_modules/express/lib/router/layer.js:95:5)
    at next (/document-db-service/node_modules/express/lib/router/route.js:137:13)

I am not able to understand why this error is coming up.Please suggest the changes that need to be done to resolve this error.

Anand Deshmukh
  • 1,086
  • 2
  • 17
  • 35
  • Wow.. I am also running into this same error since last night. I'm seeing the connection work for ~10 seconds before getting that error. – John Kalberer May 22 '17 at 15:23
  • How do you resolve that ?? – Anand Deshmukh May 22 '17 at 15:25
  • I haven't otherwise I would have answered you. – John Kalberer May 22 '17 at 15:26
  • 1
    I'm having the same issue, although I'm spinning up a new prototype today so this doesn't represent a regression for me. I can avoid the issue by removing the `replicaSet=globaldb` from the connection string, but I suspect that's probably not a _good_ thing to do. – Shawn McKnight May 22 '17 at 16:35
  • This issue has been recognized by Microsoft (https://feedback.azure.com/forums/599059-azure-cosmos-db-mongodb-api/suggestions/19361521-fix-bug-that-destroys-nodejs-mongodb-connection-po) but as of 6/27/2017 they have not updated it with any further details. – Shawn McKnight Jun 27 '17 at 18:40
  • Quick update... the team has a fix and is being deployed with 9/2017 estimated roll out. See https://feedback.azure.com/forums/599059-azure-cosmos-db-mongodb-api/suggestions/19361521-fix-bug-that-destroys-nodejs-mongodb-connection-po – jsturtevant Aug 14 '17 at 15:12

1 Answers1

6

I run into the same problem, removed the replica set parameter in the connection string mongodb: ........./?ssl=true**&replicaSet=globaldb** then it worked fine

amonk
  • 1,769
  • 2
  • 18
  • 27
MD8515
  • 61
  • 1