MongoServerInstance.Disconnect() contains an NRE point

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 1.1
    • Affects Version/s: 1.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Robert Stam
            Reporter:
            Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: