我看到很多这样的错误
“现有连接被远程主机强行关闭”
在 Mongo 日志中,因为我从开源 c# 驱动程序切换到支持 10Gen 的驱动程序。一旦发生此错误,我的网站就会变得无响应。我感觉它与连接池的实现方式有关。请参阅下面的日志,我正在从集合中删除索引,删除所有项目,然后通过添加我想要的所有行然后重新索引集合来“重新创建”集合。完成后不久,我总是收到错误消息:'现有连接被远程主机强行关闭'
[conn46] run command admin.$cmd { ismaster: 1 }
[conn46] query admin.$cmd ntoreturn:1 command: { ismaster: 1 } reslen:64 0ms
[conn46] query BtSearchCache.system.indexes reslen:1407 nreturned:7 0ms
drop indexes
[conn46] run command BtSearchCache.$cmd { deleteIndexes: "Board_41", index: "ix_QuickSearch" }
[conn46] CMD: dropIndexes BtSearchCache.Board_41
[conn46] dropIndexes: ix_QuickSearch not found
[conn46] query BtSearchCache.$cmd ntoreturn:1 command: { deleteIndexes: "Board_41", index: "ix_QuickSearch" } reslen:81 1ms
remove all data from collection
[conn46] remove query: {} 1428ms
insert data (thousands of rows, omitted here)
[conn46] insert BtSearchCache.Board_41 0ms
[conn46] insert BtSearchCache.Board_41 0ms
[conn46] insert BtSearchCache.Board_41 1ms
[conn46] insert BtSearchCache.Board_41 0ms
[conn46] insert BtSearchCache.system.indexes 0ms
create indexes
[conn46] run command admin.$cmd { getlasterror: 1 }
[conn46] query admin.$cmd ntoreturn:1 command: { getlasterror: 1 } reslen:65 0ms
ERROR a few minutes later
[conn46] MessagingPort recv() errno:10054 An existing connection was forcibly closed by the remote host. 192.168.100.216:51111
[conn46] SocketException: 9001 socket exception
[conn46] end connection 192.168.100.216:51111