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. Ben Rogers says:

    Will this work when the computer is locked?

  2. Jānis Elsts says:

    @Trix:
    Thank you for the feedback!

    @Ben Rogers:
    I would assume so. As long as RoC is running, it should work even if the session is locked.

  3. Daniel says:

    This program just saved me days of programming to keep my server application running. It has been crashing due to an unknown reason, and this program works great. Any place I can donate?

  4. Daniel says:

    oops… didnt think the first comment sent properly.

  5. Jānis Elsts says:

    Thank you, it’s good to hear positive feedback. If you like, you can send a donation to this PayPal account: whiteshadow@w-shadow.com

    (I’ve deleted the duplicate comment.)

  6. Patrick Picard says:

    Any reason it RoC is not working well with shell applications?

    My Exec:
    C:\strawberry\Perl\bin\perl.exe “C:\Autotrader\TradeDaemon.pl”

    Working Directory:
    C:\Autotrader

    Execute Command after crash
    C:\strawberry\Perl\bin\perl.exe “C:\Autotrader\TradeDaemon.pl”

    RoC starts the app, but automatically things its crash and will wait the grace to restart it again.

    In the assume section, i have the following selected:
    – it isnt running
    – wait 10 seconds

  7. Jānis Elsts says:

    I’m not sure why that would happen.

    When the application is running, try clicking “Add” and “Select a running application…”. Does it show up in the list of running applications?

  8. Jānis Elsts says:

    There’s something that I noticed immediately after posting the previous comment: your executable path (“My Exec”) includes a command line argument. That isn’t going to work with RoC. You need to enter only the EXE file path. For example:
    C:\strawberry\Perl\bin\perl.exe

    RoC can execute a command with arguments, but it doesn’t/can’t use those arguments when checking if the application is running.

  9. ReTard says:

    Hello Dev,

    I appreciate your little tool. It’s awesome and it would be even more awesome if there would be a capability to assign a label to the particular positions in the restart list. Reason: I run one application with different start parameters via different .bat files and since in the list the .exe file is showed I can’t distinguish by first look what is what. Thank you.

  10. Daniel says:

    Hi Janis,

    Just sent over a few bucks. Sorry the exchange rate is so terrible. Trump says he will work on it after the wall is installed.

  11. Alexander Vallejo says:

    Very good tool, saved me a lot of time building similar functionality utility; works really well for me. I would like to be able to donate or what ever way is possible to help you mantaining and improving or just rewarding the dev effort.

    Thank you

  12. Jānis Elsts says:

    Thank you, it is good to hear that people like the application. As mentioned a few comments above, feel free to send a donation to this PayPal account: whiteshadow@w-shadow.com

  13. Jens says:

    Thank you for a great application. Is there any way to change application status check interval? It would use less system resources if we are able to increase status check to 1 or 5 minutes.

  14. Jānis Elsts says:

    Sorry, right now the check interval is not configurable.

    Normally, the status checks don’t use a lot of resources. Have you run into any noticeable performance issue while using RoC?

  15. Jens says:

    No, there are no performance issues. I can only see RoC app jumping in task manager from 2%-15% CPU usage. So i thought it would be good idea to put application to idle when there is no need for heavy status check.

  16. Jānis Elsts says:

    Hmm, that jump is higher than I unexpected. All right, I’ll add that idea to the “future enhancements” list.

  17. Peesjee says:

    Hi Janis,

    we are using the RoC for several years now (thanks for that!), works perfectly.

    Although, did you hear about RoC suddenly taking all the CPU on Win2016 (~30 processes configured)? This happened twice in a month and never happened before…

    Its actually happening right now, nothing special is shown in the RoC.log. Restarting RoC does not fix the problem, rebooting the Windows Server does…

    Greetz
    Pieter

  18. Jānis Elsts says:

    I’ve never experienced that myself, but another comment above also mentioned increased CPU usage (though not as high as in your case). Unfortunately, I don’t have any Windows Server machines where I could test it, so I’m not sure what can be done.

    Could you perhaps take a look at the RoC process with the Process Explorer? If you right-click a process and choose “Properties…” from the pop-up menu, it shows a bunch of performance details like per-thread CPU usage, I/O statistics, a memory usage breakdown and so on. Maybe that could provide some clues.

  19. Peesjee says:

    Hi Janis,

    proces explorer shows RoC with one application ‘under’ it. I think its no coincidence that we made a new version of that application that day. I suspect this is the cause of the problem. 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. It syas ‘not running’ and restarts the application over and over. I do not think this is the fault of RoC, but the fault of windows keeping ‘internal’ stuff pointing to that ‘old’ folder.

    Restarting the windows server always fixes the problem, thats why i think its windows related…

Leave a Reply