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. Jānis Elsts says:

    Yes, I’m using Windows 10 Pro x64 and it works fine. Maybe the problem has something to do with the specific app that you’re trying to monitor? For example, it could be the process keeps running even after the application as a whole has “crashed”.

  2. Dark says:

    I wanted to add, but it is great that you already answered and you are almost right. Process is not running and not even seen in any task manager, but RoC still sees it. It is zombie process. Looks like it can’t remove it, but at same time shows as Running, which also can’t be correct.

    Thanks.

  3. Dark says:

    Generally after days of tests RoC seems to not catch the different situations on Win 7 and 10. Shows process as Running even if not in list at all. If add the app again to list – it shows as crashed. On Win 7 I got the window “App crashed with… etc.” and it still shows Running and doesn’t close error dialog as expected. Needs more work… Would be great, if you tried more tricks and I would give feedback. “My app” crashes a lot for many reasons.

    Regards.

  4. Jānis Elsts says:

    I think to really fix that I would need a way to reproduce the problem on my own system. Trying various tricks and workarounds is very inefficient if you have to wait hours or days to see if the fix worked.

  5. Dark says:

    I can help with making the log, when I see the situation, when there should a restart happen, but it doesn’t. Currently have one machine, where the restart failed. If RoC could make a debug log of current state and what it sees.

  6. {DOU}Tommy says:

    Thanks for this! Never knew this existed. I had used Knas restarter but a server upgrade broke it. After a panic to find a new solution I finally found this. AND it works better than Knas ever did. So…thanks!!

  7. Jānis Elsts says:

    @Dark: The current version of RoC can log some things, but it doesn’t record enough detail to debug this particular issue. I suppose I’ll make a note to implement additional log levels in the future.

  8. Makoto Doita says:

    I have one request (or question).
    I’m running some application which is slow in response, and RoC often determines as it is hung. It it possible to tell RoC to wait just few seconds before it logs ‘Not responding:’?
    I am asking because this is logged like every few minutes and kind of annoying.
    Please note that I’m not discussing double check here, I just want RoC not to determine the process as not responding too quick.
    Here is the extracted log:

    2021/06/13 1:53:24 Not responding: [PID: 00000394] D:\HOME\friio\TvRock\tvrock.exe
    2021/06/13 1:53:24 D:\HOME\friio\TvRock\tvrock.exe will be treated as crashed/hanged
    2021/06/13 1:53:25 D:\HOME\friio\TvRock\tvrock.exe has recovered
    2021/06/13 1:53:27 Not responding: [PID: 00000394] D:\HOME\friio\TvRock\tvrock.exe
    2021/06/13 1:53:27 D:\HOME\friio\TvRock\tvrock.exe will be treated as crashed/hanged
    2021/06/13 1:53:29 D:\HOME\friio\TvRock\tvrock.exe has recovered
    2021/06/13 2:09:51 Not responding: [PID: 00000394] D:\HOME\friio\TvRock\tvrock.exe
    2021/06/13 2:09:51 D:\HOME\friio\TvRock\tvrock.exe will be treated as crashed/hanged
    2021/06/13 2:09:53 D:\HOME\friio\TvRock\tvrock.exe has recovered

    As you can see, the application took 2 seconds to respond, but is not hung.
    I’d be happy if I could specify [5] sec (or any small number) before RoC determines ‘Not responding.’
    Thanks!

  9. Jānis Elsts says:

    There’s currently no way to change that timeout. Also, it might not be possible to change it in general since at least one of the underlying Windows APIs that RoC uses to detect frozen/hung applications has a predefined timeout that can’t be changed by an application.

    It would probably be possible to add an option not to log unconfirmed crashes so as not to pollute the log. I’ll add this idea to my notes.

  10. […] Télécharger et exécutez Redémarrer en cas de crash. C’est une excellente idée d’avoir l’application que vous souhaitez redémarrer en cours d’exécution car cela facilite beaucoup son ajout à la liste des applications. Le redémarrage en cas de plantage doit redémarrer s’il est désactivé. […]

  11. […] Descendre et exécutez Redémarrer en cas de crash. C’est une excellente idée d’avoir maintenant l’application que vous souhaitez redémarrer en cours d’exécution car cela permet de l’ajouter à la liste des applications. Redémarrer en cas de plantage doit redémarrer en cas d’échec. […]

  12. baiguang says:

    I hope can Monitoring process Quantity 少于设定 重起

  13. baiguang says:

    I hope can Monitoring process Quantity Less than set restart

  14. AC says:

    Hi I have just tried out this lovely utility to stop a pesky security camera program (monitorclient) randomly shutting down and ceasing to record. I can’t for the life of me successfully get the RoC program to restart monitorclient.exe and log suggests that command needs escalation. I have tried right clicking the monitorclient.exe and changing the Win7 UAC options but it won’t start it and if I restart with a mouse click am still asked to confirm program possibly making changes to the computer. Is there a prefix/command I can use in your programs command field to tell RoC to start monitorclient.exe as an admin?

    Cheers

  15. Jānis Elsts says:

    Try starting RoC itself as an admin, that might help.

  16. AC says:

    Mate that seems to have worked – can’t wait to see if this may be a long term solution to this rubbish camera utility. Thanks for such an expedient reply!

  17. baiguang says:

    I hope can Monitoring process Quantity Less than set restart
    example
    @echo Off & setlocal Enabledelayedexpansion
    :main
    set file_step=1
    set times=1
    set “exes=A.exe”
    :steps
    set/a times-=1
    for /l %%a in (10 -1 0) do (
    cls& echo.& echo 还剩下 !times! 分 %%a 秒后检测进程, 请等待..
    timeout /t 1 /nobreak>nul)
    if !times!==0 (goto starts) else goto steps
    :starts
    del $ & >>$ (tasklist) & >>$1 (findstr “!exes!” “$”) & move $1 $ & cls
    for /f “delims=” %%a in ($) do set/a file_step+=1
    if !file_step! leq 2 (
    taskkill /f /im “!exes!”
    ) else goto main

  18. Jānis Elsts says:

    Do you mean something like restarting all processes that have a specific file name when the number of processes falls below a threshold? It’s an interesting idea, but I don’t think it will be implemented in RoC in the near future.

  19. baiguang says:

    yes. Language from translation

Leave a Reply