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

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

问题描述

我有一个在 node.js 中内置的 REST 服务,带有 Restify 和 Mongoose,还有一个 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天全站免登陆