事象
RocketchatサーバとMongoDBの接続がMongoTimeoutErrorとなって利用できない。
Got exception while polling query MongoTimeoutError: Server selection timed out after 10000 ms at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/sdam/topology.js:773:16) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) => awaited here: at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12) at packages/mongo/mongo_driver.js:1037:14 at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 => awaited here: at Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12) at SynchronousCursor._nextObject (packages/mongo/mongo_driver.js:1086:38) at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1100:22) at Cursor.<computed> [as forEach] (packages/mongo/mongo_driver.js:882:44) at OplogObserveDriver._runQuery (packages/mongo/oplog_observe_driver.js:729:16) at packages/mongo/oplog_observe_driver.js:699:14 at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12) at packages/meteor.js:550:25 at runWithEnvironment (packages/meteor.js:1286:24) { name: 'MongoTimeoutError', [Symbol(mongoErrorContextSymbol)]: {} }
環境情報
- Rocket.Chat Version: 3.2.2
- MongoDB Version: 4.0.18
原因/解決策
起動の順でMongoDBの後にNode.jsが起動していない。
よってMongoDBの起動が完了した段階で、Node.jsを起動するためにRocketChatの再起動を行った。
以下、補足です。
補足
MongoDB上でエラーが起きていないにもかかわらず
.. I NETWORK [listener] connection accepted from xx:36898 #13 (6 connections now open) .. I NETWORK [conn13] received client metadata from xx:36898 conn13: { driver: { name: "MongoDB Internal Client", version: "4.0.18" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } } .. [listener] connection accepted from xx:36900 #14 (7 connections now open) .. I NETWORK [conn14] received client metadata from xx:36900 conn14: { driver: { name: "MongoDB Internal Client", version: "4.0.18" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } } .. I NETWORK [listener] connection accepted from xx #15 (8 connections now open) .. I NETWORK [conn15] received client metadata from xx:52084 conn15: { driver: { name: "MongoDB Internal Client", version: "4.0.18" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } }...
事象欄に記載した通りNode.js側でエラーが発生していました。
状況として、Node.jsとMongoDBが正常に上がっていた状態でMongoDBを再起動しました。
そうすると同事象が発生したので、自動的に再接続が発生しないのかもしれません。
以上、ご参考になれば幸いです。