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. adamas says:

    Jānis, well, there’s actually a fairly simple, blood-less and legal way to try it.
    1. Get VirtualBox Portable (won’t even clog your existing system): http://www.vbox.me/ and run/install it
    2. Get an evaluation image of Windows 8 x64: http://msdn.microsoft.com/en-us/evalcenter/jj554510.aspx
    3. Install that Windows 8 x64 image from/in VirtualBox Portable: http://www.addictivetips.com/windows-tips/how-to-install-windows-8-on-virtualbox/

    That’s it. This way gives you a way to try/use a fully functional copy of Windows 8 WITHOUT affecting your existing system in any way (vbox is portable, windows is deletable).
    So you might as well try it this way. And I do understand your point about Win 8 overall, but I personally absolutely love it for one (yeah, they changed the start menu, but other than this it’s the same Win 7, but better and more reliable). And secondly, you may ignore Windows 8, sure, but people still will keep switching to it AND Microsoft will still moving forward from that milestone, not backward. So why fight it? Embrace it! 🙂

    I sincerely hope you’ll adapt you’re amazing software for Win8. But, well, thanks so very much in any way!

  2. Tomus Ratin says:

    This application stopped working one day. I fixed the problem by running the program as other user. You can create file with “.bat” extension and include there this code:

    @echo off
    „c:\WINDOWS\system32\runas.exe” /administrator(@domain.name) „C:\Program Files\program.exe” | „c:\sanur” Password of_administrator

    to doing the procedure.
    Domain name is simply name of user. Download sanur.exe (http://malecki.na8.pl/wp-content/uploads/2011/02/sanur.zip) and put the file in your system32 location (C:\Windows). In my opinion you can not find process restarter with more features. I think this one is the best (better than Restarter, Kiwi Restarter etc.). I hope I helped someone.

  3. Tomus Ratin says:

    I noticed that code in my previous post does not work, here is the correct one:
    runas /u:domain\zFirstLogin “D:\Program Files\Application Monitor\RestartOnCrash.exe” | sanur t

  4. fantastic says:

    Hi! Would you mind if I share your blog with my myspace group?
    There’s a lot of people that I think would really enjoy your content. Please let me know. Cheers

  5. Longboarder3 says:

    I like this better than restarter but one feature they have is the ability to send an email when an applications crashes by calling a vbs script. I need that feature if possible.

    Cheers

  6. manjula says:

    The programme I need to restart comes with a port number 7001.

    Although I tried the followings in the executed command box, it did not recognize it.
    “c:\………….\programme.exe 7001”
    “c:\………….\programme.exe”

    How to resolve this?

    Thanks for any help!

  7. Jānis Elsts says:

    Here’s what I would do: put the command in a .bat file and use its filename as the command to execute.

  8. manjula says:

    Thanks Janis. But the it doesn’t work. I made the .bat file with the following codes and run.
    cd “e:\……….\……..\folder3”
    programme.exe 7001

    But this code works for the other programmes whenever there is no port.

    Could you pls. help me more.

    Thanks!

  9. Jānis Elsts says:

    Does the .bat file work if you run it manually? If not, what error message (if any) does it display?

  10. Mike says:

    Janis,

    Great program, thanks! Any chance of getting an email notifier so an email is sent for each crash? Thanks!

  11. Longboarder3 says:

    Hi Janis, I seem to have a lot of false alarms in the log file to the point of trying to watch system processes for an event. I see there are lots of recoveries but only a few times has it executed a re-start. Here is a sample of my log where there was not really a problem. (I have changed the names of the programs.)
    How can I prevent these log entries where there is not a problem?

    1/08/2013 5:01:15 p.m. Directory\test\application.exe is not running
    1/08/2013 5:01:15 p.m. Directory\test\application.exe will be treated as crashed/hanged
    1/08/2013 5:01:46 p.m. Executing a command : “Directory\test\application.exe”
    1/08/2013 5:01:47 p.m. Directory\test\application.exe has recovered

  12. Jānis Elsts says:

    Try enabling the “Wait X seconds and double-check” option. If it is already enabled, increase the grace period to something like 60 seconds.

  13. Longboarder3 says:

    yep I have several installations of this software going all day long.
    I am testing different times from 30 seconds to 120 seconds. Just examined the 120 second one and have some more recoveries without restarts. Please tell me how often ROC checks and hat it looks for? Perhaps we will get our program to continue some activity to try to show ROC it is not asleep ? We are only concerned when it actually restarts the appication so perhaps the log file could be set to ‘show only restarts ‘.

  14. Jānis Elsts says:

    I don’t have the source code handy at the moment, but as far as I remember it checks once per second or so. What it looks for depends on how you’ve configured it:

    – “It’s not responding to Windows messages” – this option checks if the application window is still responsive. A program can become unresponsive if it’s doing some heavy processing, is stuck in an infinite loop, or similar. For example, you’ve probably noticed that sometimes when you click a button in some program it doesn’t seem to do anything and the application window sort of “fades out” for a few moments. ROC would treat this as “not responding”.
    – “It’s not running” – this option just checks if there’s at least one running process with the specified filename.

  15. Riccardo says:

    Hi this app is totally awesome but i have a little problem, randomly after some days of uptime the application list become blank and I have to close e and open again “Restart On Crash”. I can send you some logs. Here you can find a screenshot: http://s12.postimg.org/yzw6azoy5/roc.jpg

    Thank you and sorry for my bad english 🙂

  16. Jānis Elsts says:

    Huh, I have no idea what could cause that. Maybe you could check the memory usage the next time it happens in case it’s a side-effect of a memory leak or some such?

  17. Riccardo says:

    Ok i’ll try it, thanks.

  18. Riccardo says:

    Here is the screenshot with task manager and blank application list: http://s12.postimg.org/6mtaaqcrx/Restart_On_Crash.jpg

  19. Jānis Elsts says:

    Memory and CPU usage look normal in that screenshot.

    Sorry, I don’t really know what else to try.

Leave a Reply