-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.5.2
-
Component/s: None
-
None
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
> 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.