bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sleep defunct


From: Bob Proulx
Subject: Re: Sleep defunct
Date: Wed, 29 Jan 2003 22:12:15 -0700
User-agent: Mutt/1.4i

Pavan Kumar Purohit wrote:
> I have used 'sleep' in a C shell script. This script in turn executes a
> program. sleep is used to give delay between execution of the program in
> the script.
> Every 2-3 hours the sleep becomes defunct (see below)
> root    21624  0.0  0.0     0    0 pts/4    Z    01:02   0:00 [sleep 
> <defunct>]
> root    21623  0.0  0.0  1308    4 pts/4    T    01:02   0:00 sleep 180
> 
> As a result the program is not executed.
> Do u suggest anything.

Defunct processes are processes whose parent has not waited on them.
They are dead.  But they have not gone away.  They are called zombies.
The sleep program slept, then exited.  But the parent script has a
problem and is not cleaning up after its children.

The system needs to transfer the return code from the child process to
the parent.  Until the parent asks for the return code the system
cannot release the process slot used by the defunct process.  If the
parent exits then all children of that process will be inherited by
the init process, pid #1.  One of the jobs of the init process is to
clean up after these children.

Since your process has become defunct that means the script that ran
it has a problem and not sleep.  Look at the 'ps -efH | less' listing
and see the parent process.  Inspect the script around it and see what
is happening there.  If you kill the parent process the defunct
children will be cleaned up by init.

Also, you mentioned that you were using csh.  That program is not
considered very robust for scripts.  Without even looking I feel
certain the problem is in your /bin/csh binary.  Consider programming
in /bin/sh instead.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]