-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: 1.9.2
-
Component/s: Connectivity
-
None
-
Environment:Windows 2008 Enterprise Edition, x64, SP1
-
None
-
None
-
None
-
None
-
None
-
None
-
None
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.