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

Interminable heartbeat attempts in ServerMonitor class after a failed conection

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Works as Designed
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.4.1
    • Connectivity
    • MS Windows 10 x64, MongoDB 3.2,3.4, .Net Framework 4.5

    Description

      Hello,
      I don't know is this a bug or a feature, but in fact it is very annoying thing.
      If you try to connect to a MongoDB server with a wrong login\password or an another incorrect property that prevents establishing of a successful connection, an instance of MongoServer class will attempt to connect to the server while the process active.

      var server = new MongoServer(anyWrongProps);
      server.Connect(); // an exception should be raised here
      

      After that the interminable loop

      while (!heartbeatCancellationToken.IsCancellationRequested)
      

      will be in progress in MongoServer.MonitorServerAsync() method.

      I have tried to fix it with the following code

      ClusterRegistry.Instance.UnregisterAndDisposeCluster(server.Cluster);
      

      Seems it works, but perhaps it can be a reason of some problems. I don't know is this safe.

      Best regards,
      Alex

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            alexeybut Alexey Butalov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: