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

race condition in DB.requestEnsureConnection can cause NullPointerException

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.9.0
    • Affects Version/s: None
    • Component/s: Cluster Management
    • None

      With a replica set connection, use of DB.requestEnsureConnection has a race condition which can cause a NullPointerException:

          java.lang.NullPointerException
      	at com.mongodb.DBTCPConnector$MyPort.requestEnsureConnection(DBTCPConnector.java:483)
      	at com.mongodb.DBTCPConnector.requestEnsureConnection(DBTCPConnector.java:129)
      	at com.mongodb.DBApiLayer.requestEnsureConnection(DBApiLayer.java:110)MongoDBConnection.java:482
      

      This race condition is not actually new, but the NPE happens more frequently now that the driver is handling a list of servers that can be either mongos server or replica set members.

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

              Created:
              Updated:
              Resolved: