-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.11.0
-
Component/s: Connection Management
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
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).