Operating System - Tru64 Unix
1748213 Members
2957 Online
108759 Solutions
New Discussion юеВ

Re: Getting rid of defunct processes

 
SOLVED
Go to solution
Alice Daniel
Frequent Advisor

Getting rid of defunct processes

My app has a parent that forks a child. Sometimes, one of them dies and leaves a defunct process, along with shared memory segments. I try to get rid of the shared memory and kill the defunct task, but to no avail. I then have to reboot the system to clean up the shared memory and to get rid of the defunct process. How can I kill a defunct process and get rid of the associated shared memory
5 REPLIES 5
Michael Schulte zur Sur
Honored Contributor
Solution

Re: Getting rid of defunct processes

Hi,

A defunct task is already dead. You can not kill a "zombie".
The problem is obviously that the app does not expect a child to die and does not make the necessary wait calls to relieve the child from its return code.
Did you stopp the app and see what happens?

greetings,

Michael
Ralf Puchner
Honored Contributor

Re: Getting rid of defunct processes

use ipcrm to release shared memory.

But a zombie indicates also a programming problem with the application. So it is time to redesign the application.
Help() { FirstReadManual(urgently); Go_to_it;; }
Ross Minkov
Esteemed Contributor

Re: Getting rid of defunct processes

Alice,

Tru64 UNIX puts exiting child processes in the state if their parent process is still running and has not caught the SIGCHLD signal or executed a wait() system call. Processes in this state cannot be killed until the process that forked them is killed or the system rebooted...
So as Michael already said, try stopping or restarting the app and see if that takes care of the defunct processes.

Regards,
Ross
Mobeen_1
Esteemed Contributor

Re: Getting rid of defunct processes

Alice,
I would try to do the following

1. Try to shutdown and start the application
thats been creating those zombie processes
as suggested by others.

2. Check if the zombie processes are still
present

3. If they are present, then the only way
i would assume getting rid of them is
by REBOOTING the server

rgds
Mobeen
Ralf Puchner
Honored Contributor

Re: Getting rid of defunct processes

Sorry, but the last 2 postings are totally wrong:

A zombie process is a process which has died and whose parent process is still running and has not wait()ed for it. In other words, if a process becomes a zombie, it means that the parent process has not called wait() or waitpid() to obtain the child process's termination status. Once the parent retrieves a child's termination status, that child process no longer appears in the process table.

You cannot kill a zombie process, because it's already dead. It is taking up space in the process table, and that's about it.

If any process terminates before its children do, init inherits those children. When they die, init calls one of the wait() functions to retrieve the child's termination status, and the child disappears from the process table.

A zombie process is not, in and of itself, harmful, unless there are many of them taking up space in the process table. But it's generally bad programming practice to leave zombies lying around, in the same way
that it's generally a Bad Thing to never bother to free memory you've malloc()ed.
Help() { FirstReadManual(urgently); Go_to_it;; }