Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

how to avoid a <defunct> process?

by TKSpitty (Initiate)
on Oct 14, 2004 at 12:26 UTC ( #399176=perlquestion: print w/ replies, xml ) Need Help??
TKSpitty has asked for the wisdom of the Perl Monks concerning the following question:

Monks, In a certain script I am starting a process in the background using fork and I catch the pid. The process I started also starts new child processes itself. When I try to kill this process (I use kill 2, then kill 9), it changes into a <defunct> process and the weird thing is, when I check whether it's alive with kill 0, it returns true... I don't know much about process management in Perl. Can anyone tell me how I can avoid getting a defunct process when I kill a forked process? Any help is appreciated, Martijn

Comment on how to avoid a <defunct> process?
Replies are listed 'Best First'.
Re: how to avoid a <defunct> process?
by Fletch (Chancellor) on Oct 14, 2004 at 12:45 UTC
Re: how to avoid a <defunct> process?
by tstock (Curate) on Oct 14, 2004 at 13:52 UTC
    perlipc should give you all the help you need; and if you want to disregard the forked children signal then set
    $SIG{CHLD} = 'IGNORE';
    Tiago

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://399176]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-29 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls