Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1105

C# driver hangs indefinitely on one of the environments where the Mongo service is down.

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.9.2
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Windows 2008 Enterprise Edition, x64, SP1

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            surikov.pavel@gmail.com Pavel Surikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: