The Runner receivers JS code, I wrote a babel plugin [1] to insert watchdog checks inside each loop (for, while, dowhile), also in each arrow function, that checks each time a function executes.
If the check scope is async, the watchdog awaits for a Promise that resolves immediately to give the opportunity to other functions in the thread, this function collaborative, does not hijack nodejs thread, so, it is allowed to run 10 minutes default.
If the scope is not async, the nodejs thread can be hijacked, so, it is allowed to run 100 milliseconds.
The watchdog stops the function by throwing a TimeoutError if the time is consumed in each case.
Finally, a check in inserted on each `catch`, and `finally` statements for the following cases:
try {
// infinite loop
} catch(e) {
// infinite loop
} finally {
// infinite loop
}
[1] https://github.com/yosbelms/remote-func/blob/master/server/f...