Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.11.0
-
None
Description
It's possible for _masterPortPool to be null in the call to MyPort.get from DBTCPConnector.authenticate, causing this mis-leading exception to be thrown:
throw new MongoException("Rare case where master=null, probably all servers are down");
|
This can be reproduced reliably when constructing a MongoClient with a List of mongos nodes and a call to DB.authenticate is the first operation on the MongoClient (as is typical).
This issue can be worked around by replacing the call to DB.authenticate with a call to the MongoClient constructor that takes a List<MongoCredential>: http://api.mongodb.org/java/current/com/mongodb/MongoClient.html#MongoClient(java.util.List, java.util.List, com.mongodb.MongoClientOptions).