Meteor app crash randomly throwing a 'MongoError: server instance pool was destroyed' error

Meteor app crash randomly throwing a 'MongoError: server instance pool was destroyed' error

我使用 mup 将流星应用程序部署到 AWS 服务器,它使用 docker 来部署该应用程序。我还使用了 mLab 沙盒数据库。

问题是,一段时间后应用程序在没有警告的情况下崩溃。崩溃意味着该应用程序仍在运行,但不会从数据库加载数据。我在两个不同的服务器上有两个版本的应用程序(暂存和生产)运行。但是两者都有这个问题。在 docker 日志中,我看到这个错误重复了很多次:

Exception in setInterval callback: MongoError: server instance pool was destroyed
    at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:446:16)
    at MongoConnection.<anonymous> (packages/meteor/helpers.js:119:1)
    at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:771:49)
    at [object Object].update (packages/mongo/collection.js:589:29)
    at AccountsServer.Ap._expireTokens (packages/accounts-base/accounts_server.js:1100:14)
    at packages/accounts-base/accounts_server.js:1173:14
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
    at packages/meteor/timers.js:6:1
    at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)
    - - - - -
    at Function.MongoError.create (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:29:11)
    at basicWriteValidations (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:433:51)
    at [object Object].Server.update (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:543:16)
    at [object Object].Server.update (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/server.js:386:17)
    at updateDocuments (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/collection.js:1037:19)
    at [object Object].Collection.update (/bundle/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/collection.js:1075:44)
    at MongoConnection._update (packages/mongo/mongo_driver.js:560:18)
    at MongoConnection.<anonymous> (packages/meteor/helpers.js:118:1)
    at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:771:49)
    at [object Object].update (packages/mongo/collection.js:589:29)

知道发生了什么吗?

在客户端浏览器控制台中,我看到这个错误:

WebSocket connection to 'wss://oursite.com/sockjs/373/2lrpal10/websocket' failed: WebSocket is closed before the connection is established.

更新 npm-mongo 和 mongo 为我解决了这个问题。

meteor update --all-packages