Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-793

Race condition in com.mongodb.DBTCPConnector#authenticate method

      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).

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: