com.mongodb.MongoException: not talking to master and retries used up

JIRA | Alvin Richards | 6 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Problem: Three member replica set. I have code that is inserting into a collection, the connection string has been configured with the three members MongoOptions mo = new MongoOptions(); mo.connectionsPerHost = MAX_THREADS + 5; mo.autoConnectRetry = true; String addresses = args[0]; while (addresses.contains(",")) { String next[] = addresses.split(","); connectionList.add(createAddress(next[0])); addresses = next[1]; } connectionList.add(createAddress(addresses)); Mongo mongo = new Mongo( connectionList , mo ); When I cause the current primary to step down (rs.stepDown()), the Java driver throws the following Exception in thread "Thread-1" com.mongodb.MongoException: not talking to master and retries used up at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:206) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:223) at com.mongodb.DBCollection.findOne(DBCollection.java:486) at com.mongodb.DBCollection.findOne(DBCollection.java:475) at com.mongodb.DB.command(DB.java:137) at com.mongodb.DB.getLastError(DB.java:283) at InsertSpeed$RunnerInsert.run(InsertSpeed.java:72) Not sure if there is something else that can be set in order to continue the insert process during the take over event. Workaround: When going through the mongos process (in a sharded + repl set deployment), can the connection is to the mongos process then this exception does not occur. Business Case: Reliability User Expereince

    JIRA | 6 years ago | Alvin Richards
    com.mongodb.MongoException: not talking to master and retries used up
  2. 0

    Problem: Three member replica set. I have code that is inserting into a collection, the connection string has been configured with the three members MongoOptions mo = new MongoOptions(); mo.connectionsPerHost = MAX_THREADS + 5; mo.autoConnectRetry = true; String addresses = args[0]; while (addresses.contains(",")) { String next[] = addresses.split(","); connectionList.add(createAddress(next[0])); addresses = next[1]; } connectionList.add(createAddress(addresses)); Mongo mongo = new Mongo( connectionList , mo ); When I cause the current primary to step down (rs.stepDown()), the Java driver throws the following Exception in thread "Thread-1" com.mongodb.MongoException: not talking to master and retries used up at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:206) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:223) at com.mongodb.DBCollection.findOne(DBCollection.java:486) at com.mongodb.DBCollection.findOne(DBCollection.java:475) at com.mongodb.DB.command(DB.java:137) at com.mongodb.DB.getLastError(DB.java:283) at InsertSpeed$RunnerInsert.run(InsertSpeed.java:72) Not sure if there is something else that can be set in order to continue the insert process during the take over event. Workaround: When going through the mongos process (in a sharded + repl set deployment), can the connection is to the mongos process then this exception does not occur. Business Case: Reliability User Expereince

    JIRA | 6 years ago | Alvin Richards
    com.mongodb.MongoException: not talking to master and retries used up

    Root Cause Analysis

    1. com.mongodb.MongoException

      not talking to master and retries used up

      at com.mongodb.DBTCPConnector.call()
    2. MongoDB Java Driver
      DB.getLastError
      1. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:206)
      2. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208)
      3. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208)
      4. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:223)
      5. com.mongodb.DBCollection.findOne(DBCollection.java:486)
      6. com.mongodb.DBCollection.findOne(DBCollection.java:475)
      7. com.mongodb.DB.command(DB.java:137)
      8. com.mongodb.DB.getLastError(DB.java:283)
      8 frames
    3. Unknown
      InsertSpeed$RunnerInsert.run
      1. InsertSpeed$RunnerInsert.run(InsertSpeed.java:72)
      1 frame