Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
2.5.2
-
None
-
None
-
ALL
Description
> 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.