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 correspoding 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.
Related posts :

371 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. Jānis Elsts says:

    proces explorer shows RoC with one application ‘under’ it.

    I think that just means that RoC was what launched the application.

    Another thing i noticed since the last windows server version, is that if you ‘move’ a folder (with an application in it of course) to a new destination, the RoC is not able to ‘detect’ the new destination of the running application.

    This might vary depending on if you entered the full application path in RoC settings.

    For example, if it’s just “application.exe” and moving the application causes problems, there’s probably a bug of some kind. However, if it’s “c:\path\to\application.exe”, RoC will indeed keep looking for the application at the old location. It’s not designed to detect moved folders.

  2. Peesjee says:

    Hi Janis,

    i was not very clear in my previous response (my fault). Even if I set the executable path and the working directory correctly (after moving of course), it is still not ‘detecting’ it correctly. Only a server reboot fixes this. I’m still convinced that this is not the fault of RoC.

  3. Jānis Elsts says:

    That’s odd. I just tested it on Win10 and it worked as expected: after moving an application RoC showed it as “crashed”, but when I updated the path in RoC settings it went back to showing “running” in less than 2 seconds. Maybe it does have something to do with the OS, or another application is inadvertently interfering with RoC somehow.

  4. Peesjee says:

    Thx for testing. We only use RoC on a Windows Server, perhaps there is a difference here.

    Just one thought: did you just move the application, or the whole folder (for example, a level deeper in de folder structure)?

  5. Jānis Elsts says:

    For the sake of simplicity, I did this test with a stand-alone application that’s just one EXE file. I moved the EXE file to a new folder that I created on the same drive.

  6. Peesjee says:

    Hi Janis,

    i tested your method and it works indeed by just moving the exe. But if you move the folder to a different folder (ex. c:\temp\test2 -> c:\temp\test\test2) i can simulate the problem (on a windows server2016)

  7. Jānis Elsts says:

    It looks like you’re right. I tried moving the folder and RoC still “thought” the application was in the old location. I’m guessing that, for some reason, Windows doesn’t update the metadata associated with a running process in this case. It works fine if I manually restart the application after moving it and updating RoC settings.

    While this is an interesting result, I suspect that it isn’t related to the high CPU usage problem that you encountered.

  8. Peesjee says:

    Hi Janis,

    just want to mention another thing, perhaps related to the high CPU usage already mentioned on this forum. Are they also mentioning memory usage? For example, i have a windows 2016 server with only two things to monitor. I can see the RestartOnCrash.exe takes about 11 MB, then suddenly 120 MB. It toggles every few seconds back from 11 MB to 120 MB and back to 11 MB.

    I don’t think i have seen this on older versions on windows…


  9. Jānis Elsts says:

    No, as far as I recall, they didn’t mention sudden memory usage spikes. It’s possible that they just didn’t notice it or look for it.

    I tested this myself by leaving RoC running for a few hours while monitoring two applications. On my Windows 10 Pro machine the memory usage generally fluctuated between 2 MB and 5 MB. It never exceeded 6 MB.

  10. Ryan says:

    Is there a way to have the script distinguish between multiple instances of an application? For example: I run multiple instances on a server of minecraft which uses java.exe. If one instance crashes ROC will close all instances of java.exe and can not discern between the faulting instance. Can you tie this to look at the PID of the application or some way of pointing to the specific instance? I’m not sure the working directory seems to do that. Thank you.

  11. Jānis Elsts says:

    Unfortunately, there’s currently no way to do that. RoC considers all processes with the same EXE file name to be the same application. It doesn’t check the command line or the working directory.

Leave a Reply