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

Not automatically recovering after a failover

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      After triggering a failover for an AWS document DB cluster with multiple nodes after the server recovers the C# driver does not work until restarted.

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      How to Reproduce

      Driver version:  2.23.1
      DB: AWS document DB, size intermediate with 3 nodes with the same priority
      Server: app runner instance in VPC with AWS DocumentDB from above.

      Using C# driver above in an asp.net server deployed to AWS app runner configured as above
      1. Have a server running and handling write requests
      2. Using failover-db-cluster to trigger a failover event (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/failover-db-cluster.html)
      3. Keep the server responding to requests
       
      Code used
       
      var settings = MongoClientSettings.FromUrl(new MongoUrl(connectionString));
      _client = new MongoClient(settings);

      Put([FromBody] TestDocument document)

      {   await collection.InsertOneAsync(document); }

       
      Expected
      Once the failover is complete it is expected that the server will be able to process requests again without restarting or recreating the mongo db client.
       
      Actual
      The server is not able to complete write requests again until restarted.
      Other servers can connect and write afterward.
       
      Workaround
      The only way I found to automatically recover was to recreate the client with different settings then recovers after the fall over

      Additional Background

      Connection string options ssl=false&retryWrites=false&readPreference=SecondaryPreferred

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            tim.mcgrath@objective.com tim mcgrath
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: