Friday, November 26, 2010

Killing IIS Zombie Processors

We've all been there! Well all developers and testers are least. You've got a process that is hung and you just can't kill the blasted thing. On *nix its as easy as getting the Process ID (PID) of the process and running 'kill -9' which is about as close as you're going to get to travelling back in time and killing the processes grandparents back when they lived on a pig farm.

Anyway, in Windows there is nothing that is there available to all and sundry to do this. But thankfully when I encountered this problem today I used some Google Fu to get to How To Kill Windows Processes That Won't Die which led me to the good folks at SysInternals and their PsTools suite.

PsTools is a collection of tools to help with system management, included within it is PsKill which, by all rights should solve my problem which is a pesky IIS worker process that refuses to roll over and play dead. So following the instructions I tried to kill the process.

No dice, access is denied. Hmm okay I guess I need to run it as administrator.
D:\Downloads\PsTools>pskill.exe 3256
PsKill v1.13 - Terminates processes on local or remote systems
Copyright (C) 1999-2009  Mark Russinovich
Sysinternals - www.sysinternals.com
Unable to kill process 3256:
Access is denied.
Are you kidding me? WTF? Damn it. This is going to be harder than expected. Off to poke around some more. There are a couple of tricks to try in the comments of the first post I found but none of them seem to work.

Sysinternals Forums? Nope, they only seem to contain Access Denied errors for remote computers. File locked by something? I'll give Unlocker a go. No dice!

Oh man I feel like I idiot! I thought I had tried 'iisreset' but apparently not because I just tried it again and it worked.

Son of a... well that was a waste of 15 minutes.

I think PsKill wanted me to kill it as the user that had started the process, which was a user that IIS created, so I didn't have the password. Lesson learned, my google fu isn't as fu-tastic as it should be. A more specific initial searched would've killed the process sooner.

1 comment: