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

Driver could not reconnect to the server after socket exception, had to recycle application pool.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.7
    • Component/s: None
    • None
    • Environment:
      Client: Windows .NET 4, Server: Linux (CentOS).

      After a network error occurred between one of our web servers and Mongo ("SocketException: No such host is known") all subsequent requests to the replica set from that particular web server failed with the same error, while other web servers worked perfectly fine. After recycling the IIS application pool no more connection errors have been reported.

      Our database object is a singleton. We did a quick test pointing to a single-instance server (no replica set) and we were not able to reproduce the issue after stopping and restarting the mongo server (after mongo restarted the drivers were able to contact Mongo again without recycling the application pool). We think this might have something to do with the replica set.

      Stack trace:

      2013-06-10 12:52:17,118 WARN -
      MongoDB.Driver.MongoConnectionException: Unable to connect to a member of the replica set matching the read preference Primary: No such host is known. ---> System.Net.Sockets.SocketException: No such host is known
      at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
      at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
      at MongoDB.Driver.MongoServerAddress.ToIPEndPoint(AddressFamily addressFamily) in C:\build\mongo-csharp-driver\Driver\Core\MongoServerAddress.cs:line 196
      at MongoDB.Driver.MongoServerInstance.GetIPEndPoint() in C:\build\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 339
      at MongoDB.Driver.Internal.MongoConnection.Open() in C:\build\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 368
      at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message, WriteConcern writeConcern, String databaseName) in C:\build\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 559
      at MongoDB.Driver.Internal.MongoConnection.RunCommand(String databaseName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError) in C:\build\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 425
      at MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection) in C:\build\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 695
      at MongoDB.Driver.MongoServerInstance.Connect() in C:\build\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 480
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.<>c_DisplayClassd.<ConnectInstance>b_c(Object _) in C:\build\mongo-csharp-driver\Driver\Internal\MultipleInstanceMongoServerProxy.cs:line 415
      — End of inner exception stack trace —
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ThrowConnectionException(ReadPreference readPreference) in C:\build\mongo-csharp-driver\Driver\Internal\MultipleInstanceMongoServerProxy.cs:line 509
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference) in C:\build\mongo-csharp-driver\Driver\Internal\MultipleInstanceMongoServerProxy.cs:line 224
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ChooseServerInstance(ReadPreference readPreference) in C:\build\mongo-csharp-driver\Driver\Internal\MultipleInstanceMongoServerProxy.cs:line 159
      at MongoDB.Driver.MongoServer.AcquireConnection(MongoDatabase database, ReadPreference readPreference) in C:\build\mongo-csharp-driver\Driver\Core\MongoServer.cs:line 1058
      at MongoDB.Driver.MongoCursorEnumerator`1.AcquireConnection() in C:\build\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 299
      at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\build\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 312
      at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\build\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 230
      at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)

            Assignee:
            Unassigned Unassigned
            Reporter:
            stefanoric Stefano Ricciardi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: