Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Daemon causing zombies under 5.8

by virtualsue (Vicar)
on Jan 13, 2003 at 21:42 UTC ( [id://226610]=note: print w/replies, xml ) Need Help??


in reply to Daemon causing zombies under 5.8

What is a way to debug to find the cause of zombies?

There is only one cause for the creation of a zombie process: the parent process hasn't collected a child process exit status via waitpid or set $SIG{CHLD} = 'IGNORE' (this signals your program's lack of interest in its offspring). In other words, if your program doesn't explicitly ignore SIGCHLD, all its child processes will hang around like the undead until waitpid is called for each one. If you look at the perldoc for Proc::Fork, the synopsis shows the basic format for creating and disposing of child processes, and the waitpid call is clearly shown. If your program really doesn't make zombies under 5.6.1, I'd say something has been fixed in 5.8. :-)

Replies are listed 'Best First'.
Re: Re: Daemon causing zombies under 5.8
by trs80 (Priest) on Jan 13, 2003 at 22:48 UTC
    Thanks for the second set of eyes virtualsue. I had been over the $SIG{CHLD} = 'IGNORE' problem before when working on a different solution, I can't belive I didn't notice it was missing from this code.
      You're welcome. I suggest you think about removing the recursion that Helter pointed out, too. I never noticed it when I skimmed your program the first time, because I was only looking for the cause of your zombie problem. Wouldn't it be much cleaner to structure your code like
      while (1) { process_files(); # loop(), essentially sleep $interval; }
      ?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://226610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found