Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Running Windows Server 2003, I have some processes that when killed take a a few minutes of 100% cpu to die.

Using Process Explorer to view the processes threads I always see 2 threads, with one of them using lots of cpu and stuck in !endthreadex

Any idea what could cause these processes to not-die for so long? Is there any way for me to force kill such a process?

share|improve this question
    
Might help to know the processes' name –  l0c0b0x Oct 14 '09 at 3:50
    
Can we to assume you've already tried Task Manager? –  John Gardeniers Oct 14 '09 at 3:57
1  
@John, "Process Explorer" is a task manager on drugs: technet.microsoft.com/en-us/sysinternals/bb896653.aspx –  l0c0b0x Oct 14 '09 at 4:01
1  
If it is on drugs that may be part of the problem. –  MDMarra Oct 14 '09 at 4:43
    
Sorry, it seems Process Explorer has grown up. I haven't looked at it for quite a few years. –  John Gardeniers Oct 14 '09 at 6:31
show 2 more comments

1 Answer

When you try to kill a process, Windows will first attempt to end it gracefully through the normal code paths before taking it down forcefully. The reason why it's stuck at 100% CPU is most likely that you have a loop or similar in your tear down that is spinning around waiting for something to happen (e.g. like a database connection to completely close) without a Thread.Sleep in it. It's possible that the something it's waiting for never happens (owing to the abnormal exit caused by killing it) and so it's stuck until Windows decides to take it down by force. Examine your shutdown code for the process and you should find the culprit for that.

Appropriate for SO at this stage, I would think.

share|improve this answer
    
Does this mean that "kill" is really only sending the process a signal to stop, and then wait for it? Is there a way to control the timeout? –  DanJ Oct 17 '09 at 20:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.