mongoError:拓扑已被破坏 [英] mongoError: Topology was destroyed

查看:147
本文介绍了mongoError:拓扑已被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Restify和Mongoose内置在node.js中的REST服务,以及一个mongoDB,它的集合包含大约30.000个常规大小的文档. 我的节点服务通过pmx和pm2运行.

I have a REST service built in node.js with Restify and Mongoose and a mongoDB with a collection with about 30.000 regular sized documents. I have my node service running through pmx and pm2.

昨天,突然,节点开始清除错误,并显示消息"MongoError:拓扑已被破坏",仅此而已. 我不知道这是什么意思,可能触发了什么.谷歌搜索时,也没有太多发现.所以我想在这里问.

Yesterday, suddenly, node started crapping out errors with the message "MongoError: Topology was destroyed", nothing more. I have no idea what is meant by this and what could have possibly triggered this. there is also not much to be found when google-searching this. So I thought I'd ask here.

今天重新启动节点服务后,错误停止出现. 我也有其中一个正在生产中运行,这让我感到害怕,这可能会在任何给定时间发生在运行在那里的设置的相当关键的部分中.

After restarting the node service today, the errors stopped coming in. I also have one of these running in production and it scares me that this could happen at any given time to a pretty crucial part of the setup running there...

我正在使用以下版本的提及的软件包:

I'm using the following versions of the mentioned packages:

  • 猫鼬:4.0.3
  • 重新调整:3.0.3
  • 节点:0.10.25

推荐答案

这似乎意味着您的节点服务器与MongoDB实例的连接在尝试写入时已中断.

It seems to mean your node server's connection to your MongoDB instance was interrupted while it was trying to write to it.

看看 Mongo产生该错误的源代码

Mongos.prototype.insert = function(ns, ops, options, callback) {
    if(typeof options == 'function') callback = options, options = {};
    if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed')));
    // Topology is not connected, save the call in the provided store to be
    // Executed at some point when the handler deems it's reconnected
    if(!this.isConnected() && this.s.disconnectHandler != null) {
      callback = bindToCurrentDomain(callback);
      return this.s.disconnectHandler.add('insert', ns, ops, options, callback);
    }

    executeWriteOperation(this.s, 'insert', ns, ops, options, callback);
}

这似乎与评论中提到的Sails问题无关,因为未安装任何升级来加速崩溃或修复"

This does not appear to be related to the Sails issue cited in the comments, as no upgrades were installed to precipitate the crash or the "fix"

这篇关于mongoError:拓扑已被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆