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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.5.5
    • Component/s: JavaScript, Write Ops
    • 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 }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Using maxTimeMS with $where returns:

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

      expected

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

              Assignee:
              Unassigned
              Reporter:
              Ross Lawley
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: