[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sleep defunct
From: |
Pavan Kumar Purohit |
Subject: |
Re: Sleep defunct |
Date: |
Thu, 30 Jan 2003 14:15:29 +0530 (GMT+05:30) |
Hello Bob,
thanks for the mail. I experiance the same problem in /bin/bash
The Shell code is very simple. I excute the program binary and sleep for
180 seconds in an infinate loop(while(1)).
Do you think that is is due to swap space (since there is no I/O request)
that the process is killed.
One observation I made is if I increase the sleep duration the program
runs for a longer time.
I am sort of newbee. and I am sorry if I am wasting your time.
Is there an alternate command for sleep in shell?.
thanks
regards
pavan
On Wed, 29 Jan 2003, Bob Proulx wrote:
> 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
>