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

MongoClient Connection issues.

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      I have an issue with connections failing in a certain scenario:

      Architecture:

      website#1 with primary#1
      website#2 with secondary#2
      website#3 with secondary#3

      Settings: new MongoClientSettings

      { ReplicaSetName = "rs", Servers = < 3 server names >, ConnectionMode = ConnectionMode.ReplicaSet, ConnectTimeout = new TimeSpan(0,0,60), ReadPreference = (slaveOk) ? ReadPreference.Nearest : ReadPreference.Primary, WriteConcern = WriteConcern.Acknowledged, }


      I run this command:
      var client = MongoClient(Settings);
      await client.GetDatabase("admin").RunCommandAsync("

      {replSetGetStatus:1}

      ")

      and generally receive a correct response with myState either being 1 or 2.

      However, sometimes whilst these sites are running I will take offline secondary#2 - and run up a local non-rs instance on port 37017. When I do that, website#2 begins to respond with:

      A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector

      { AllowedLatencyRange = 00:00:00.0150000 }

      }. Client view of cluster state is { ClusterId : "1", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "

      { ClusterId : 1, EndPoint : "Unspecified/127.0.0.1:27017" }

      ", ....

      Now - I would have expected the website to fall over to retrieve secondary#3 - but its not doing that.

      Am I doing something wrong?
      Should perhaps my MongoClient be more globalized within the AppDomain (maybe - but is it related).

      Hope you can help.

            Assignee:
            Unassigned Unassigned
            Reporter:
            paul.reed Paul Reed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: