-
Type:
Bug
-
Resolution: Done
-
Priority:
Unknown
-
None
-
Affects Version/s: 2.12.1
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
We are receiving EOF exceptions on ~5% of total mongo queries. Exceptions are more visible during higher load but does not depend on high load only.
CPU usage on MongoDB: 5-20%
RAM usage on MongoDB: 50-70%
Active connections on MongoDB: 350-450
Mongo connection configuration with socket configuration fromĀ CSHARP-1151
Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
string connectionString = "...&replicaSet=replset&maxPoolSize=200"; string databaseName = "..."; MongoClientSettings clientSettings = MongoClientSettings.FromUrl(new MongoUrl(connectionString)); Action<Socket> socketConfigurator = s => s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 120); clientSettings.ClusterConfigurator = cb => cb.ConfigureTcp(tcp => tcp.With(socketConfigurator: socketConfigurator)); X509Certificate2 certificate = GetCertificate(); clientSettings.SslSettings = new SslSettings { ClientCertificates = new[] { certificate } }; clientSettings.UseTls = true; services.AddSingleton(new MongoClient(clientSettings).GetDatabase(databaseName));
Exception:
An exception occurred while opening a connection to the server. Received an unexpected EOF or 0 bytes from the transport stream.
Exception call stack:
MongoDB.Driver.MongoConnectionException: at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__51.MoveNext at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification at MongoDB.Driver.Core.Servers.Server+<GetChannelAsync>d__34.MoveNext ... Inner exception System.IO.IOException handled at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__51.MoveNext: at System.Net.Security.SslStream+<ReceiveBlobAsync>d__172`1.MoveNext at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess at System.Net.Security.SslStream+<ForceAuthenticationAsync>d__171`1.MoveNext ...