Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have A LOT of defunct 'sh' processes running.

When I execute this command, to count them:

ps -ax | grep sh | wc -l

It says I've got 2655 at the moment. Do they use up any system resources?

I have no idea where they're coming from, this is the only data the ps command gives me:

32637 ?        Z      0:00 [sh] <defunct>

Does anyone know how to stop this from happening, and how to kill these processes?

share|improve this question
1  
A problem can occur if you get so many zombie processes that the PIDs run out. You currently have 32767 PIDs, though, and they are reused once a process releases the PID. With no PIDs left, new processes cannot start (or they kick old processes out. I actually don't know which, but I believe it is the first option. Couldn't find the information quickly right now, though). –  Daniel Andersson Aug 25 '12 at 20:01

2 Answers 2

up vote 3 down vote accepted
lsof -p 32637

will give you more information on the process. Looking at the parent process that is causing this can help prevent it.

share|improve this answer
    
Thanks, some defunct processes didn't have any information, others showed files from an sshfs mount were open. At least I know where to look now. –  skerit Aug 30 '12 at 19:52

Do they use up any system resources?

I believe not much other than a slot in the process table.

how to stop this from happening

Identify what is their parent process that spawned them and find out why it isn't waiting for its children to die (and hence not reaping them)

how to kill these processes?

You can't kill something that is already dead. If the parent is killed, init should eventually inherit them and reap them for you.

share|improve this answer

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.