Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12764

Using maxTimeMS & Javascript can lead to different errors from the server

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5.5
    • Component/s: JavaScript, Write Ops
    • Labels:
    • ALL
    • Hide

      In the shell:

      var t = db.max_time_ms;
      t.drop();
      t.insert([{},{},{}]);
      t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", mode: "off"}).ok;
      
      cursor = t.find({$where: function() { sleep(100); return true; }}).maxTimeMS(100);
      // Returns
      error: { "$err" : "JavaScript execution terminated", "code" : 16712 }
      
      // Turn on a fail point
      t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", mode: "alwaysOn"}).ok;
      cursor = t.find({$where: function() { sleep(100); return true; }}).maxTimeMS(100);
      // Returns
      error: { "$err" : "operation exceeded time limit", "code" : 50 }
      
      Show
      In the shell: var t = db.max_time_ms; t.drop(); t.insert([{},{},{}]); t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut" , mode: "off" }).ok; cursor = t.find({$where: function() { sleep(100); return true ; }}).maxTimeMS(100); // Returns error: { "$err" : "JavaScript execution terminated" , "code" : 16712 } // Turn on a fail point t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut" , mode: "alwaysOn" }).ok; cursor = t.find({$where: function() { sleep(100); return true ; }}).maxTimeMS(100); // Returns error: { "$err" : "operation exceeded time limit" , "code" : 50 }

      Using maxTimeMS with $where returns:

      { "$err" : "JavaScript execution terminated", "code" : 16712 } 

      expected

       { "$err" : "operation exceeded time limit", "code" : 50 }

            Assignee:
            Unassigned Unassigned
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: