|Do you know where your variables are?|
Ingoring Child Processes And glob()by barndoor (Pilgrim)
|on Jul 28, 2000 at 13:55 UTC||Need Help??|
barndoor has asked for the wisdom of the Perl Monks concerning the following question:
I have a bit of a chewy problem which has been giving me a headache all morning.
I've got a script which fork/execs child process which are then of no concern to the parent. I had this running fine apart from the children leaving themselves as zombies once they had completed. After a quick read of the Cookbook I put in:
Problem solved I thought, no more zombies and all is good in the world.
However when I reran the script I got the following messages:
I got three of these messages, 1 for each glob() in the script and with various chunk numbers. The globs themselves were still returning the right result but the messages were causing havoc as they went to the console even though this was running in background and with STDOUT and STDERR redirected to a logfile.
After doing more digging I found that glob() shells out to run itself. Therefore this is a child process and ignoring child signals seems to be causing the problem. Take the IGNORE out and back come the zombies but the messages go.
I've thought of reenabling the child signal handler to DEFAULT around the globs as below:
However sooner or later one of my child processes is going to finish just a glob runs and will zombie itself.
Can anyone come up with a nice clean solution to this? I've not got a great deal of process/signal handling experience so any advice would be appreciated.