If you are working with automatic process, interfaces or anything that works in the background (with a new process every time) you probably familiar with situations when something goes wrong (network failure, memory shortage etc) and our automatic process gets stuck.

After a little time has passed, and even if the problem resolved itself, the old processes and tasks are still running on the server and consuming memory and CPU usage. In situations like these usually, most users will try to terminate each stuck process and try to get the system to normal. After working with a lot of process and automatic interfaces I’ve decided to write a program (command line app) that can kill “stuck” processes.

A stuck process is a process that will never terminate on its own, and will not be able to recover and do useful work it was designed to do.

How to recognize a stuck process or task?

Well, that really depends on the process itself, and how much time it regularly takes to complete a normal process. For example, I have a task that takes an excel file from the network, does some calculations and modifications on it, and afterward uploads it to a database. If this whole process usually takes under 5 minutes, it’s safe to say that a process that is an hour old probably won’t do its job and it’s stuck on one of the stages. Killing it could release the excel file and the whole process could start all over again.

stuck process

A picture of a Windows task manager with stuck processes

 

Advanced Task Killer

I build the ATK as a console application, that accepts parameters, which one of them is how old the process. So you can control the age of the process you are trying to terminate, and thus not affecting young and still active running tasks.

You can purchase Advanced Task Killer here

Thank you for supporting me and buying one of my products!

Example of usage:

c:\atk.exe /n notepad,calculator /t 60

This will terminate all notepad and calculator that are opened more than 60 minutes.

Terminate tasks older than x automatically

Because this is a console application with parameters, it can be easily incorporated into a batch file and run with the Windows Task Scheduler. You can set it to run every 5 minutes. Only processes older than the defined parameter will be terminated.

 

Leave a comment