[CSHARP-3578] .NET 5: Received an unexpected EOF or 0 bytes from the transport stream. Created: 16/Apr/21  Updated: 19/Apr/21  Resolved: 16/Apr/21

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 2.12.1
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: Modestas Stirbys Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

VM:
Azure datacenter
Windows Server 2019 64bit
8GB RAM
2 cores x 2.39 GHz

Application:
.NET 5
Mongo ConnectionString: "...&replicaSet=replset&maxPoolSize=200"

MongoDB:
Version: Mongodb (4.2)
Instances: 2
CPU: 3 Cores
RAM: 4 GB



 Description   

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

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 
   ...



 Comments   
Comment by Modestas Stirbys [ 16/Apr/21 ]

OK thanks, I will keep asking IBM Mongo support where we are paid customer and as the last resort I will try community forums...

Comment by Dmitry Lukyanov (Inactive) [ 16/Apr/21 ]

yes, currently it looks like not the driver issue

Comment by Modestas Stirbys [ 16/Apr/21 ]

So you are sure that this is not an issue in Mongo C# driver + .net 5?

Comment by Dmitry Lukyanov (Inactive) [ 16/Apr/21 ]

support.mongodb.com is paid, if you're not commercial support subscriber, please choose the MongoDB community portal option.

Comment by Modestas Stirbys [ 16/Apr/21 ]

following this link: support.mongodb.com
I get the following screen

The MongoDB Support Portal is available to members of a supported customer project. Please make sure your MongoDB project owner has added you as a member of a project.

If you believe this is an error, or you received an email saying your account has been enabled, please contact the MongoDB Support Operations team.

Comment by Dmitry Lukyanov (Inactive) [ 16/Apr/21 ]

got it, please follow the above suggestion about how to create a support issue in mongo systems.

Comment by Modestas Stirbys [ 16/Apr/21 ]

It's internal support ticket in IBM Cloud portal.

Comment by Dmitry Lukyanov (Inactive) [ 16/Apr/21 ]

Can you post a link?

Comment by Modestas Stirbys [ 16/Apr/21 ]

We use MongoDB through IBM Cloud and I have already contacted support there but they were not able to help until now.

Comment by Dmitry Lukyanov (Inactive) [ 16/Apr/21 ]

Hi there, thank you for reaching out. As this sounds like a support issue, I wanted to give you some resources to get this question answered more quickly:

  • Our MongoDB support portal, located at support.mongodb.com
  • Our MongoDB community portal, located here
  • If you are an Atlas customer, you can review your support options by clicking Support in the top menu bar of the Atlas UI

Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue.

Thank you!

Generated at Wed Feb 07 21:45:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.