Infinite loops are destructive to the usability of applications; in many cases the user may lose unsaved work or be unable to receive a complete output.
In our ECOOP paper we present Jolt, a system for detecting and escaping infinite loops at runtime. At a user's request, Jolt can attach to and monitor the execution of the program. Jolt checks if the program has entered an infinite loop in which the computation is making no progress at all---at the beginning of each loop iteration the program is in exactly the same state. If this is true, then Jolt offers the user the option to escape the loop by continuing execution of the program at the instruction that follows the loop.
In our case studies, Jolt was able to detect seven of the eight infinite loops that we found in common UNIX command-line utilities (ctags, grep, look, ping, and indent). For three of these eight loops, the strategy of escaping the loop also is the exact fix that the developers later implemented to fix the program. And for all of the loops, escaping an infinite loop proved to be more useful than terminating the program---it allowed the user to successfully recover functionality, by allowing the program to save temporary work and continue processing additional inputs.
For more information, check out the project page at