Why sometimes Windows cannot kill a process?
2013-10
Right now I'm trying to Run/Debug my application in Visual Studio, but it cannot create it because the last instance of the app.vshost.exe
is still running. Then, by using the Task Manager I'm trying to kill it, but it just remains there with no signal of activity.
Beyond that particular case (maybe a Visual Studio bug), I'm very curious about the technical reasons why sometimes Windows cannot kill a process?
Can, an enlighted OS related developer, please try to explain?
(And please don't start a Unix/Linux/Mac battle against Windows.)
The cause is usually some irresponsive drivers which have unfinished I/O requests in progress. http://blogs.technet.com/markrussinovich/archive/2005/08/17/unkillable-processes.aspx
One possible reason: You can't kill a task that's attached to a debugger.
The only solution is to stop the task from the debugger itself.
Open the Properties page for the project, go to the Debug tab, and check "Enable unmanaged code debugging". Or, uncheck the option for using the host process.
One reason would be that you don't have permission to kill it. E.g. if the process is running as administrator and you are a normal user.
If the last app.vshost.exe is still running, just connect to that process with the debugger.
Should be found in menu under Debug->AttachToProcess then choose the hanging process and connect to it.
When I attach to the process I get "Unable to attach to a crashing process".
This problem is a really annoying one.
Perhaps an examination of some of the tools cited here could lead to answers?
http://stackoverflow.com/questions/49988/really-killing-a-process-in-windows
(Just now I found that pskill was the only of several tools that could kill a process running under one user's Windows 7 session, from another user's session (or credentials, I suppose.)
You can!
Using ProcessHacker (right click on the process) -> Terminator.
How can I kill a process from the command prompt on Windows NT? Preferably with a tool that comes with the operating system.
If you had XP or later you could use TASKKILL
. This on not NT though.
I think you're going to have to download something to do this. I'd recommend pskill
from Sysinternals.
You can use this either with a process ID or just with a process name. For example:
pskill notepad.exe
Another option is KILL
from the NT Resource Kit.
To kill process with children (like apache), from Windows XP to Windows Seven :
TASKKILL /T /F /PID 4520
There are a couple of choices:
KILL Command
kill process name or id
or
kill -f process name or id
AT Utility
at time /interactive cmd /c kill -f process name or id
And of course
Reboot :-)