问题描述
在我们的MongoDB集群(3个mongos,3个数据副本,3个配置副本)中,有时应用程序会捕获此类错误
2020-09-17 16:25:47,2547 [48]()错误
发生未处理的异常:打开与服务器的连接时发生异常。
MongoDB.Driver.MongoConnectionException:打开与服务器的连接时发生异常。
---> MongoDB.Driver.MongoConnectionException:从服务器接收消息时发生异常。
---> System.IO.IOException:无法从传输连接中读取数据:连接尝试失败,因为一段时间后被连接方未正确响应,或者由于连接的主机未能响应而建立的连接失败。 / strong>
---> System.Net.sockets.socketException:连接尝试失败,因为一段时间后连接方未正确响应,或者由于连接的主机未能响应,建立的连接失败
---内部异常堆栈跟踪的结尾---
在System.Net.sockets.socket.Awaitablesocketasynceventargs.ThrowException(SocketError错误)
在System.Net.sockets.socket.Awaitablesocketasynceventargs.GetResult(Int16令牌)
位于System.Threading.Tasks.ValueTask 1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from prevIoUs location where exception was thrown --- at MongoDB.Driver.Core.Misc.StreamExtensionMethods.ReadBytesAsync(Stream stream,Byte[] buffer,Int32 offset,Int32 count,CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync() --- End of inner exception stack trace --- at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync() at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBufferAsync(Int32 responseto,CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessageAsync(Int32 responseto,IMessageEncoderSelector encoderSelector,MessageEncoderSettings messageEncoderSettings,CancellationToken cancellationToken) at MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol
1.ExecuteAsync(IConnection连接,CancellationToken cancelToken)
在MongoDB.Driver.Core.Connections.IsMasterHelper.GetResultAsync(IConnection连接,CommandWireProtocol`1 isMasterProtocol,CancellationToken cancelledToken)
在MongoDB.Driver.Core.Connections.ConnectionInitializer.InitializeConnectionAsync(IConnection连接,CancellationToken cancelledToken)
在MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancelletoken)
....
(日志级别= 3) 很多这样的超时时间
2020-09-17T16:25:47.094 + 0300 D NETWORK [TaskExecutorPool-0]计时器收到错误:CallbackCanceled:取消了回调
我可以提供的完整日志。
当我们直接连接到数据副本时-我们没有这样的问题,不会重现问题。 因此,我们需要进行调查-当我们与mongos合作时,出现超时的原因是什么?
应用程序和mongos在同一Windows服务器上运行(Windows 2012 R2)。 在其他Linux服务器(4.1.12-124.32.1.el7uek.x86_64)上运行的数据和配置副本。 MongoDB版本4.0.12。
我之前在https://jira.mongodb.org/browse/SERVER-50942中曾问过,但他们建议在此社区中问...
请帮助我们找到造成超时的原因...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)