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

Unable to connect when Primary switches

      The Primary server on my replicaset became slow, due to a runaway process on the server. Eventually it failed altogether, and a new Primary was elected.
      My client applications failed to switch to the new Primary.

      First of all I got this:

      MongoDB.Driver.MongoConnectionException: Unable to connect to the primary member of the replica set: Timeout waiting for a MongoConnection.. ---> System.TimeoutException: Timeout waiting for a MongoConnection.
      at MongoDB.Driver.Internal.MongoConnectionPool.AcquireConnection (MongoDB.Driver.MongoDatabase database) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServerInstance.Connect (Boolean slaveOk) [0x00000] in <filename unknown>:0
      — End of inner exception stack trace —
      at MongoDB.Driver.Internal.ReplicaSetConnector.Connect (TimeSpan timeout, ConnectWaitFor waitFor) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServer.Connect (TimeSpan timeout, ConnectWaitFor waitFor) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServer.Connect (ConnectWaitFor waitFor) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServer.ChooseServerInstance (Boolean slaveOk) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServer.AcquireConnection (MongoDB.Driver.MongoDatabase database, Boolean slaveOk) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCollection.InsertBatch (System.Type nominalType, IEnumerable documents, MongoDB.Driver.MongoInsertOptions options) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document, MongoDB.Driver.MongoInsertOptions options) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document, MongoDB.Driver.SafeMode safeMode) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCollection.Insert[BsonDocument] (MongoDB.Bson.BsonDocument document) [0x00000] in <filename unknown>:0
      at MsgExchange.Messages.svr_Accounts.Account.UpdateGPS (MsgExchange.Messages.GPS.TrackerMessage trackerMessage) [0x00000] in <filename unknown>:0 ~~

      And then this, even after the server problem was fixed, and the Primary was switched back to the original server:

      System.TimeoutException: Timeout waiting for a MongoConnection.
      at MongoDB.Driver.Internal.MongoConnectionPool.AcquireConnection (MongoDB.Driver.MongoDatabase database) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServerInstance.AcquireConnection (MongoDB.Driver.MongoDatabase database) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoServer.AcquireConnection (MongoDB.Driver.MongoDatabase database, Boolean slaveOk) [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCursorEnumerator`1[MongoDB.Bson.BsonDocument].AcquireConnection () [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCursorEnumerator`1[MongoDB.Bson.BsonDocument].GetFirst () [0x00000] in <filename unknown>:0
      at MongoDB.Driver.MongoCursorEnumerator`1[MongoDB.Bson.BsonDocument].MoveNext () [0x00000] in <filename unknown>:0
      at MsgServer.Collections.Accounts.clsStoreForwardUtils.SendStoreForward (MsgExchange.Messages.svr_Accounts.Account account) [0x00000] in <filename unknown>:0 ~~

      I had to restart my client applications.

        1. ConsoleWindowOutput.txt
          163 kB
        2. ConsoleWindowOutput-2.txt
          108 kB
        3. TestReplicaSetFailover.zip
          21 kB

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            logicethos Stuart Johnson
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: