defunct processes on Solaris 1.0

defunct processes on Solaris 1.0

Post by Maya Mathew » Wed, 19 Mar 1997 04:00:00



Hello,

I'd like to know the reason defunct processes are caused.

We have defunct processes being caused because of the following logic

Use vfork to create child process
The child process uses execlp to launch a seperate binary.
The parent process waits in a loop and calls waitpid() to determine if
the child process has terminated.
If the child process has not terminated in a predefined time interval
the parent process issues a kill -15 signal to kill the child process.

We observed that the child process thus killed leaves a trail of a
defunct process.

The parent process did not have a signal handler to trap any signals
from this errant child process. Could this be a problem.

Could some one explain why this could be happening and how can I solve
this issue.

Thank you in advance
Maya

 
 
 

defunct processes on Solaris 1.0

Post by Vince Arcur » Wed, 19 Mar 1997 04:00:00


Maya,

The parent process is waiting to see if the child process
exits...it doesn't so the parent kills the child.  The defuncts
you are seeing are processes that were waiting for a condition
to be satisfied by your child process (i.e. the child's children).
Since the child process is being forced to terminate with a "kill"
it is leaving that condition unsatisfied and thus the "defunct"
process will not go away because the condition they are waiting
for is never met.  You need to see which process are becoming
defunct and use truss and snoop and the like to see what
condition they are waiting for.

  --Vince


> Hello,

> I'd like to know the reason defunct processes are caused.

> We have defunct processes being caused because of the following logic

> Use vfork to create child process
> The child process uses execlp to launch a seperate binary.
> The parent process waits in a loop and calls waitpid() to determine if
> the child process has terminated.
> If the child process has not terminated in a predefined time interval
> the parent process issues a kill -15 signal to kill the child process.

> We observed that the child process thus killed leaves a trail of a
> defunct process.

> The parent process did not have a signal handler to trap any signals
> from this errant child process. Could this be a problem.

> Could some one explain why this could be happening and how can I solve
> this issue.

> Thank you in advance
> Maya

--

   -------------------------------------------------------------------
   | Vince Arcuri   http://www.obs.net   Open Business Systems, Inc. |
   |  Disclaimer:   My thoughts & opinions are exclusively my own.   |
   -------------------------------------------------------------------

 
 
 

defunct processes on Solaris 1.0

Post by Allen Kirb » Wed, 19 Mar 1997 04:00:00



> Hello,

> I'd like to know the reason defunct processes are caused.

> We have defunct processes being caused because of the following logic

> Use vfork to create child process
> The child process uses execlp to launch a seperate binary.
> The parent process waits in a loop and calls waitpid() to determine if
> the child process has terminated.
> If the child process has not terminated in a predefined time interval
> the parent process issues a kill -15 signal to kill the child process.

> We observed that the child process thus killed leaves a trail of a
> defunct process.

> The parent process did not have a signal handler to trap any signals
> from this errant child process. Could this be a problem.

> Could some one explain why this could be happening and how can I solve
> this issue.

> Thank you in advance
> Maya

Defunct means the parent process didn't issue a wait system call which
is where the process table entry for the child gets cleaned up.  This
may indeed have something to do with not handling signals, because
you would get a SIGCLD (death of child) signal in the parent.  Add
this signal handling (even if it is to ignore it) and see if the
problem goes away.  After doing the kill -15, do you do another wait?
You need to do this.  Both of these together should get rid of the
defunct process.
--
---
Allen Kirby                     AT&T ITS Production Services

 
 
 

defunct processes on Solaris 1.0

Post by Mike Biggi » Tue, 25 Mar 1997 04:00:00



> Hello,

> We observed that the child process thus killed leaves a trail of a
> defunct process.

We had a similar problem with defunct processes* about under
Solaris 2.4. In our case the parent process was a listener which
waits on a port. Upon demand, it execs a server which then sets up
a socket stream to the requesting client. When the server shuts
down, it leaves a defunct process behind.

Originally, we had code in the listener to catch the SIGCHLD
signal such as: 'signal(SIGCHLD, (sigHandler)reapchild);', where
reapchild called waitpid(). For some reason this wouldn't work
under Solaris (although it worked fine on other Unix platforms).

We found the solution to the problem is to replace the signal(...)
function call with a call to 'sigignore(SIGCHLD);'. Ignoring the
signal allows children to terminate without becoming defunct.
(This behaviouris actually mentioned in the man pages.)

Hope this helps.

Mike.

--
Mike Biggin, Database Services
DENR, South Australian Government

Phone: +61 8 8204 9217; Fax: +61 8 8204 9017

Unless explicitly attributed, the opinions expressed are personal
and not those of DENR or the South Australian Government.

 
 
 

1. Defunct Process on Solaris!!!!

Hi,
   We have a paging application which uses /usr/bin/cu utility to connect to
modems and send out pages. Some times on  Solaris system the application
will die  while sending out a page, which will cause cu process to gin in
defunct state.

This is how the defunct process looks like
    uucp 2657 1 0 0:01 <defunct>

Now we can't kill this process. The only way to make the modem active again
is to  reboot the system. Now on AIX, we can kill the process.

Does anybody know how to solve this issue?

Thanks.

2. Need dbx API or equivalent...

3. Why <defunct> process after leaving a fork()ed process?

4. ATI Xpert 98 with 8 M.

5. Patch for defunct processes under Solaris 2.4?

6. External Modem for a 43P

7. Removing "defunct" processes in solaris 5.5.1

8. 3c905 problems

9. Solaris 2.6: sshd leaves hundreds of defunct processes

10. Solaris: fork()-ed child process becomes <defunct> and not terminate.

11. solaris 2.4, X11R6, xdm = <defunct> processes ?

12. Solaris, defunct processes after wait

13. How to kill TCP connection of dead/defunct process on Solaris