[CSHARP-1105] C# driver hangs indefinitely on one of the environments where the Mongo service is down. Created: 17/Nov/14  Updated: 08/Feb/23  Resolved: 28/Oct/17

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

Type: Bug Priority: Major - P3
Reporter: Pavel Surikov Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 2008 Enterprise Edition, x64, SP1



 Description   

I'm trying to get the list of collection names from the Mongo database, but if I do this on a machine where the Mongo service is down I have to wait almost indefinitely. The problem doesn't appear on other systems however. I tried to set ConnectionTimeout and SocketTimeout, but it doesn't help. Also I noticed from the stack trace and code, that the connection is opened with TcpClient.Connect(), which is synchronous and doesn't have any timeout settings (except SendTimeout and ReceiveTimeout that do not have any impact on the connection itself). Here is the piece of code where this happens:

MongoConnection.Open():
tcpClient.NoDelay = true; // turn off Nagle
tcpClient.ReceiveBufferSize = MongoDefaults.TcpReceiveBufferSize;
tcpClient.SendBufferSize = MongoDefaults.TcpSendBufferSize;
tcpClient.Connect(ipEndPoint);

I wonder if it is possible to run it asynchronously and wait the timeout that we pass in server connection settings.



 Comments   
Comment by Jeffrey Yemin [ 28/Oct/17 ]

The 1.x branch is no longer under active development.

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