Automatically Restart Crashed Or Hanged Applications

Don’t you hate it when programs hang or crash? I find it especially annoying when a background application like an IM client or a bandwidth monitor silently crashes – sometimes I only notice the problem hours later when I’ve already missed a bunch of messages. I’m sure you’ve encountered a few “Not responding” errors and some irritatingly crash-prone applications yourself.

If you have an unstable program that you absolutely need to run at all times, but don’t want to waste your time monitoring and manually restarting it every time it croaks, I might have something interesting for you.

Restart on Crash is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. You can add any number of applications to monitor, enable/disable them individually and edit the command line that will be used to restart an application.

Restart on Crash doesn’t require installation and stores all it’s configuration data in a “settings.ini” file in the program’s folder, so it’s portable. It should be compatible with most NT-based Windows versions.

Download Restart on Crash (1.4 MB)

Screenshots & Documentation

Main application window

The main window

  • To add a new application to monitor, click the “Add” button or press the Ins key.
  • To delete on or more applications from the list, select them and click “Delete” or press Del.
  • To edit the per-application configuration, double-click the corresponding row. This will open the editing dialog (see below).
  • You can also access the RoC configuration by clicking “Settings” and view the activity log by clicking “Show Log”. The log contains information about crashed/hanged applications, executed commands, and so on.
Editing the monitor settings for an application

Editing the monitor settings for an application

Well, this one should be pretty self-explanatory 🙂 One detail to keep in mind is that enabling the “It isn’t running” option will make Restart On Crash treat the application as if it has crashed even if you have purposefully it closed it. You can get around this by disabling the monitoring of the application before you close it.

The configuration dialog. Yes, that's it.

The configuration dialog. Yes, that’s it.

“Grace period” is how long Restart on Crash will wait before trying to terminate/restart an application that it has just terminated/restarted. This is intended to prevent a scenario where RoC kills a hanged program, restarts it, decides it has hanged again (e.g. if the program is non-responsive while starting up) and wrongfully terminates it again.

Known Issues

  • If you configure RoC to automatically kill a hanged application, it will terminate all instances of that application when doing so. This may be fixed eventually.

Release Notes

2022-11-02

  • The “execute a command” feature can now launch shortcuts (.lnk files). Potentially, it can now run almost any type of file as long as file associations are set up correctly.

2019-12-17

  • Improved “application is not responding” detection.
  • Added a “Clear Log” button to the Log window.

2019-08-24

  • Added a “Restart Now” option to the application pop-up menu. It restarts the selected application immediately without waiting for the grace period to expire.
Related posts :

621 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. Kuro says:

    Can RoC handle .bat files? Or it can only handle EXE files?

  2. Jānis Elsts says:

    It can start .bat files, but it can’t properly monitor them. It’s the same problem as with Java: when RoC looks at the list of running processes, it just sees cmd.exe, not a specific .bat file.

  3. Vishwas says:

    Is it a freeware?

  4. Jānis Elsts says:

    Yes, you can download and use it for free.

  5. Stan Winiecki says:

    Hi,

    Does the option “Wait X seconds and double-check” pertain to “not running” applications as well?
    I have an old program, that from time to time processes something, opens another program for a moment, and then restarts itself. So for brief periods of time (say, up to a minute) it may not be running, and it is normal.
    It however has a tendency to crash and close by itself. When the above mentioned multi-step processing was not used, I could just run it in a BAT file loop, and it was fine. But now that we have enabled that complicated processing, my solution is no longer acceptable, because it restarts the application as soon as it closes (for a moment), which results in two processes running concurrently as soon as the application starts again on its own).

    Summing up, what i require, is an option to double-triple-quintuple-check in, say, 1 minute intervals, if the application is still not running, and only then restart it.
    Probability of hitting 5 times the moment when it’s briefly closed on its own is rather low 🙂 i’m willing to try double-check, but would prefer 5 consecutive tests, and if found running – reset the counter, and keep monitoring.

    Kind regards

  6. Jānis Elsts says:

    Yes, that option does affect situations where the application isn’t running.

    Running multiple “has it really crashed?” checks is an interesting idea. I’ve added it to my notes, but I probably won’t be able to implement any time soon. For now, checking twice is the only option.

  7. Adam says:

    I have set this up and it is working for one program, however the second program, refuses to restart, if I manually click the exe file then the program will restart,

    Can I add any arguments to force the program to start

  8. Jānis Elsts says:

    That will depend on the program. If you know the arguments that you need, you can add them to the “Execute a command” box. For example:
    "d:\abc\app.exe" /arg1 /arg2

  9. jean says:

    9/18/2018 12:18:08 PM CreateProcess error : The requested operation requires elevation

    How would I go about resolving this issue?

    Thanks

  10. Jānis Elsts says:

    Try running RoC as an administrator. Usually that’s not necessary, but it might help if you need it to monitor an application that itself requires admin privileges.

  11. Troy says:

    I have a program that runs in the background and is minimized. From time to time it crashes, and other times it is just sitting there dormant, not doing anything. I tried RoC but it kept restarting the program, even though it was still running. Have I checked an option incorrectly? Or is this how it will always function?

    Troy

  12. Jānis Elsts says:

    Normally, it shouldn’t matter if the program is in the background or not. RoC should still be able to detect that it’s running.

    If the option “It’s not responding to Windows messages” is turned on, try turning it off and see if that helps.

  13. cogmios says:

    This program is really really old. Is there a github library of the source, so we can recompile this and fix some bugs mentioned here? (or rewrite it?)

  14. Jānis Elsts says:

    No, there is no open source version.

  15. sagitter140 says:

    How come as soon as I add one process to monitor (any process, tried many different app to test) it uses 30% CPU, i’m sure I had installed before (not sure which version) I had to format the PC and didn’t use any CPU …

  16. sagitter140 says:

    Fixed, downgraded to 1.1 and CPU issue is gone …

  17. Jānis Elsts says:

    Hmm, I can’t seem to reproduce that problem on my system. RoC uses less than 2% CPU in my tests.

    Maybe it depends on the OS or the system configuration. What Windows version are you running?

  18. Enoch Bryant says:

    Do you know how to pass a command to log in the execute a command. I am using stransmit and when I use the commands manually in cmd I can log to a log file

    “C:\Tools\SRT\stransmit-rendezvous-GRE.exe” -s:1000 “udp://127.0.0.1:9009” “srt://172.28.1.224:9500?mode=rendezvous&latency=6000&conntimeo=10000” -r:1 > C:\Tools\SRT\log.txt

    but the same command crashes in restart on crash when I put it in the execute a command line.

  19. Jānis Elsts says:

    Maybe you could put that command in a .bat file and then use that file as the command to execute?

Leave a Reply