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

MongoServerInstance.Disconnect() contains an NRE point

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.1
    • 1.0
    • None
    • None

    Description

      The MongoServerInstance.Disconnect() (yes, it's internal, but it's called from public MongoServer.Disconnect()) does not check connectionPool value before calling connectionPool.Close().
      Since connection might be asynchronous (via ReplicaSetConnector), the MongoServerInstance.Connect() method might still be executing at time the MongoServerInstance.Disconnect() is called.
      This leads to MongoServerInstance.State to be MongoServerState.Conecting, but MongoServerInstance.connectionPool is still null, because, for example, MongoServerAddress.ToIPEndPoint is still resolving that hostname. I think that some additional locking and/or checking is needed to prevent such inconsistencies.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: