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

maxTimeMS doesn't stop active operations

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.2
    • Component/s: None
    • Labels:
      None
    • ALL

      > var start = new Date()
      > var c = db.test.find({$where: function() { sleep(10000); return true; }});
      > c.maxTimeMS(1000)
      error: { "$err" : "JavaScript execution terminated", "code" : 16712 }
      > var end = new Date() - start
      > end
      10021
      

      Set the sleep to 10 seconds, set the timeout to 1 second. Run a timer, it only terminates after the 10 seconds are up and not the 1 second...

      Since javascript $where doesn't allow yielding, or checking for the kill signal for that operation, it runs through to the end of the execution.

      The same thing can happen with a page fault or other long running part of a query/operation.

            Assignee:
            rassi J Rassi
            Reporter:
            sam.weaver Sam Weaver
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: