[CSHARP-1811] System.IO.IOException: Unable to read data from the transport connection Created: 25/Oct/16  Updated: 15/Nov/21  Resolved: 27/Oct/16

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

Type: Bug Priority: Major - P3
Reporter: Ivan Artemov Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ASP.NET Core (net46)


Attachments: PNG File 1.png     PNG File 2.png    

 Description   

I have MongoCollectionProvider, that registered as Singleton.
Sometimes i catch System.IO.IOException with robust connection.
I catch it sinse v2.3.
Maybe you change MongoClient behaviour and it not need to use it as Singleton ?



 Comments   
Comment by Robert Stam [ 27/Oct/16 ]

Thanks for letting us know.

Comment by Ivan Artemov [ 26/Oct/16 ]

Thank you, Robert. This is azure connection issue.
https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/_Z8YepNHnbI
Problem not in MongoDB.
Thank you. Issue can be trashed now

Comment by Robert Stam [ 26/Oct/16 ]

We have heard reports that connections that aren't used for a long time can go bad. Usually it's because there's some router along the way that flushes idle connections. You can try setting maxIdleTime to a lower value (you can do this on the connection string).

If you wish to create a single instance of MongoClient and use it repeatedly that's fine. I would actually recommend that as being better than creating a new instance of MongoClient every time you need to do something with the database.

Comment by Ivan Artemov [ 26/Oct/16 ]

I know about this message, but connection is ok and error appears when application is inactive some minutes and wake up.
At screenshot №2 i display Connection provider and i register it as Singleton in my Ioc.

MongoClient work well when i use it as Singleton ?

Comment by Robert Stam [ 26/Oct/16 ]

The System.IO.IOException indicates that there is a network problem between the application and the server, as the error message indicates:

Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respons after a period of time, or established connection failed because connected host has failed to respond.

I don't understand the second part of your question. MongoClient is not a singleton.

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