自从我从开源C#驱动程序切换到10Gen支持的驱动程序后,我在Mongo日志中看到了大量这些错误:
"远程主机强制关闭了一个现有的连接"
一旦出现此错误,我的网站就会变得无响应。我有种感觉,这与连接池实现的方式有关。请参见下面的日志,我正在从集合中删除索引,删除所有项,然后通过添加我想要的所有行并重新索引集合来“重新创建”集合。在完成所有这些操作几分钟后,我总是会收到错误消息:“远程主机强制关闭了一个现有的连接”。
[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