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
- 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.
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.
“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.
I think that just means that RoC was what launched the 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.
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.
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.
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)?
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.
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)
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.
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…
Greetz
Pieter
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.
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.
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.
Hi Janis,
I am using RoC for a gallery show. It restarts a maxmsp patch that can be finicky.
Is there a keyboard command to Force Quit RoC?
Right now I have to go to End Task in the Task Manager.
Thank you!
[…] scaricare Restart On Crash sul tuo PC, collegati al suo sito ufficiale e fai clic sul link Download Restart on Crash. A scaricamento completato, estrai in una cartella […]
Found a bug… when RoC detects app being watched is closed/crashed, it immediately restarts it and is not honoring the Grace Period in the Settings.
This is a problem when you want to manually close an app to do some maintenance. There is no time to disable RoC before it launches again.
Feature Request: Would be nice to also have a command line option that will disable RoC so we can trigger a command to disable RoC before we close app it is monitoring.
Please fix that bu, thx!
Just installed this on 2 fresh Win10 Pro installs. Same problem on both.
The “grace period” setting is for repeated restarts. What you’re describing sounds like the “Wait X seconds and double-check” option that you can find in the application settings screen. Please try that one.
[…] “Restart On Crash” とかのプロセスを監視して発生したプロセスに対する動作を指定できるソフトを導入 – ダウンロードはここからできる […]
I have been trying to find the location of the log without success.
Could you enlighten me?
Thanks…
To view or change the log file path, click the “Settings” button and look for the “Log events to a file” option.
If that option is disabled, RoC only stores the log in memory and the contents of the log are lost when you exit the application.
I’d like to monitor and restart my java program. Well, since it’s java program, the application name would always be java.exe. How does Restart on Crash can distinguish my program from other java based program? My program has a health check HTTP entry. Is there a way to add a custom rule like GETing http://localhost:1234/healthcheck and wait for X seconds for response and if noting, assume it’s dead?
How about identifying the correct java.exe process by the command line? Right now RoC only looks at the EXE file name, but I think there might be a way to also get the full command line. It will take some work, but it might be easier than adding a new kind of status checks.