To be perfectly honest, it's still not perfect, but we've come a long way! For the first time, we've compartmentalized it to the point where we're able to open source it, so here's that: Infinite Loop Buster on GitHub.
We showed him the code we were currently using to do the infinite loop stopping instrumenting, and he went so far as to rewrite it not only more efficiently and succinctly, but also without the need for escodegen. With only minor tweaks, we were able to put it into production and open source it.
Some other things to know:
- If you're looking for a version with no dependencies at all, see loop-protect.
- If you're loop is being stopped by us, but you know it's just a long-running loop, not an infinite loop, you can still adjust the timing.