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

db.eval() all broken : com.mongodb.MongoException: not talking to master and retries used up

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 2.11.1
    • Component/s: API
    • Labels:
    • Environment:

      When we talk to a given Mongo server, through the JavaAPI, with a eval(), it always fails.

      Here is a quick and dirty Java program that demonstrates the issue. If we go onto the console of the server and run the same command [eval("db.serverStatus()")] it works as expected.

      Bar.java
      import com.mongodb.DB;
      import com.mongodb.MongoClient;
      
      public class doNotUse {
      
       public static void main(String[] args) throws Exception {
          MongoClient mc = new MongoClient( "192.168.26.240", 49140 );
          DB db = mc.getDB("log");
          Object o = db.eval( "db.serverStatus()", (Object[])null );
          System.out.println(o);
        }
      
      }
      

      Fails with:

      Bar.java
      Exception in thread "main" com.mongodb.MongoException: not talking to master and retries used up
      	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:314)
      	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:316)
      	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:316)
      	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257)
      	at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310)
      	at com.mongodb.DB.command(DB.java:274)
      	at com.mongodb.DB.command(DB.java:256)
      	at com.mongodb.DB.command(DB.java:313)
      	at com.mongodb.DB.command(DB.java:211)
      	at com.mongodb.DB.doEval(DB.java:353)
      	at com.mongodb.DB.eval(DB.java:370)
      	at org.doNotUse.main(doNotUse.java:21)
      

      The server we are talking to is a slave to another master.

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

              Created:
              Updated:
              Resolved: