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

Driver could not reconnect to the server after socket exception, had to recycle application pool (still open)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Client on Windows 2008 R2. .NET environment: 4.5
      Server on CentOS.

      Description

      This is similar to CSHARP-754, but with a different call stack.
      Like in that bug, the only way we have found to fix the issue is to recycle the application pool of the web service hitting Mongo.

      Connection string like the following:
      mongodb://host1:27017,host2:27017,arbiterOnWindows:27017/?replicaSet=my_replica_set;socketTimeout=120000ms;maxPoolSize=200

      The following 2 stack traces alternate:

      Stack trace 1:
      2013-09-18 13:14:39,945 ERROR - Unable to connect to a member of the replica set matching the read preference Primary: The requested name is valid, but no data of the requested type was found.
      MongoDB.Driver.MongoConnectionException: Unable to connect to a member of the replica set matching the read preference Primary: The requested name is valid, but no data of the requested type was found. ---> System.Net.Sockets.SocketException: The requested name is valid, but no data of the requested type was found
      at System.Net.Dns.GetAddrInfo(String name)
      at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
      at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
      at MongoDB.Driver.MongoServerAddress.ToIPEndPoint(AddressFamily addressFamily)
      at MongoDB.Driver.MongoServerInstance.GetIPEndPoint()
      at MongoDB.Driver.Internal.MongoConnection.Open()
      at MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
      at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
      at MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, IBsonSerializer commandResultSerializer, IBsonSerializationOptions commandResultSerializationOptions, Boolean throwOnError)
      at MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError)
      at MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
      at MongoDB.Driver.MongoServerInstance.Connect()
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.<>c_DisplayClassd.<ConnectInstance>b_c(Object _)
      — End of inner exception stack trace —
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ThrowConnectionException(ReadPreference readPreference)
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)
      at MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference readPreference)
      at MongoDB.Driver.MongoCursorEnumerator`1.AcquireConnection()
      at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst()
      at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext()
      at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
      at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
      at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

      Stack trace 2:
      2013-09-18 13:13:44,735 ERROR - Unable to connect to a member of the replica set matching the read preference Primary
      MongoDB.Driver.MongoConnectionException: Unable to connect to a member of the replica set matching the read preference Primary
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ThrowConnectionException(ReadPreference readPreference)
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
      at MongoDB.Driver.Internal.MultipleInstanceMongoServerProxy.ChooseServerInstance(ReadPreference readPreference)
      at MongoDB.Driver.MongoServer.AcquireConnection(ReadPreference readPreference)
      at MongoDB.Driver.MongoCursorEnumerator`1.AcquireConnection()
      at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst()
      at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext()
      at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
      at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
      at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            stefanoric Stefano Ricciardi
            Votes:
            12 Vote for this issue
            Watchers:
            19 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: