-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.0
-
Component/s: 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.