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 :

605 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. White Shadow says:

    To check whether a program is still responsive, Restart on Crash finds its first top-level window and sends it a dummy message. If there is no response, it assumes the application has hung/frozen.

    Since services don’t have any visible windows, RoC can’t detect when they hang. Any ideas for an alternate detection algorithm?

  2. risingevil says:

    Are there any plans on implementing windows default variables, like %userprofile%. Maybe I’m missing something, if they have already been implemented, how do I use them?

    thanks

  3. idan york says:

    RoC is fantastic, just what i needed to keep some processes running – however – one thing keeps occurring in some XP vm’s running on vmware fusion.
    Firefox (latest) crashes regularly (bad code in a script – no matter, is only for testing automation and debugging) and occasionally, there is that annoying firefox dialog box that states “firefox is already running” – the *process* is running, but the actual window is not.
    is there a way to detect this dialog box and kill the process?
    i can’t figure it out.

  4. White Shadow says:

    No, at least not with this application. The dialog box is a Firefox-specific feature, so I don’t think there’s an API / whatever for detecting when it shows up.

  5. idan york says:

    OK, thanks for the reply. I have solved the problem with Network Automations “AutoMate” using that “Firefox is already running” dialog window (and the plugin_container.exe popup error window) as triggers to send to RoC to kill the process, letting RoC restart Firefox.
    RoC has saved me hundreds of hours of clicking and monitoring!
    THANKS!

  6. Sam says:

    Would you be able to add the feature for RoC to write its logs to the event viewer

  7. Sam says:

    Will you be able to make RoC more portable, via the use of variables in the path names of the programs RoC monitors? For instance, a variable that indicates the drive letter in which RoC is running from, so that I can put Roc on a flash drive and monitor programs that runs form that flash drive.

    thanks

    PS: you can already do this, please let me know.

  8. White Shadow says:

    Aaaand, it’s done. You can now use the variable %ROC_DRIVE% in filenames and commands, and it will be automatically replaced by the drive letter from which RoC was run when that file is checked or command executed.

    For example, if RoC is run from the D drive, “%ROC_DRIVE%\foo\bar.exe” will become “D:\foo\bar.exe”.

    Download the update.

  9. Sam says:

    Thank you so much, this is very helpful.

  10. Fenrik says:

    awww mate you are a total life-saver!! Thank you!! 🙂

  11. Ian says:

    Hi, This sounds like it might be a life saver for me too!!

    Will it function okay on windows 2000 server. I have a program that needs to run all the time.

    Cheers Ian

  12. jeff says:

    @Ian. No problems on W2000. I run it on several of these. Quite frankly.. wouldn’t be much of a program if it didn’t!

  13. Chris Gregory says:

    Hi,
    Its working great for me with some exceptions.
    About once a week all jobs disappear from the window and i need to restart it to get the monitoring working again.
    I cant see anything in the Windows Event logs.
    Is there anything I can check or debug?

    Thanks
    Chris

  14. White Shadow says:

    Hmm, that’s very unusual.

    Have you tried monitoring RoC’s memory usage? Maybe there’s a memory leak somewhere that only manifests after it has been running for a few days.

  15. […] der Not heraus bin ich auf Restart On Crash gestoßen, einer Mini-Applikation, die abgestürzte Programme wieder automatisch starten […]

  16. Marco says:

    wow, this is a great utility! Last week I lost the remote connection with my desktop PC when I was abroad, since VNC crashed. Now I keep VNC under the assistance of RoC, so I’m sure it’ll restart, if it crashes again. Thank you for the great program.

  17. Warren says:

    I have been using RoC since June 2010 and it really is an amazingly useful application.. again, thank you!

    I use it to monitor programs on stand-alone systems and i was wondering, after attempting to re-open a crashed app a set number of times consecutively, if another application could be run instead?

    i.e.
    xxx.exe hanged – ROC attempt 1 – Restart xxx.exe…
    …xxx.exe hanged – ROC attempt 2 – Restart xxx.exe…
    …xxx.exe hanged – ROC attempt 3 – Restart xxx.exe…
    …xxx.exe hanged – ROC – Run reboot.bat

    Thanks
    Warren

  18. White Shadow says:

    It might be possible to script something like that with PowerShell. Write a script that starts xxx.exe and records the number of attempted restarts in a file somewhere. Make it run reboot.bat after X attempts. Then tell RoC to execute that script when/if the app crashes.

  19. beta1 says:

    Thanks for the application! It is exactly what I was looking for and does a great job. However, I cant seem to get the program to startup minimized to tray. I have tried many things including using TrayIt! and other tray applications but it just wont start minimized in the tray. If I launch the program and then click on minimize, it goes to the tray but any other way doesnt seem to work. Is there anyway to get around this? Is there a command line option i can append to the application that will tell it to auto minimize to the tray when launched? BTW, im using Windows 7 x86. Thanks again!

  20. White Shadow says:

    That’s a known issue. Apparently, one of the libraries I use has a weird bug that screws up the application UI if it’s minimized at startup. As a workaround, I’ve deliberately left out that feature.

Leave a Reply