Plankton has asked for the wisdom of the Perl Monks concerning the following question:

Dear Wise Monks,

I am trying to find a bug in a daemon written in Perl and it sets %SIG like so:

$SIG{'CHLD'} = 'IGNORE'; $SIG{'HUP'} = 'ignore'; $SIG{'INT'} = 'CleanUp'; # INT = 2 $SIG{'QUIT'} = 'CleanUp'; # QUIT = 3 $SIG{'PIPE'} = 'CleanUp'; # PIPE = 13 $SIG{'ALRM'} = 'IGNORE'; # ALRM = 14 $SIG{'TERM'} = 'CleanUp'; # TERM = 15
I understand $SIG{'CHLD'} = 'IGNORE' and there is a sub routine CleanUp defined but no sub-routine ignore. Is this a bug and would it be causing zombies?

Replies are listed 'Best First'.
Re: Is 'ignore' the same as 'IGNORE' for %SIG?
by cdarke (Prior) on Sep 17, 2010 at 08:07 UTC
    use warnings; use strict;
    When you do, you get:
    $ ./gash.pl & [1] 7317 $ kill -HUP 7317 SIGHUP handler "ignore" not defined.


    A lack of CHLD handling can cause zombies, but HUP is generated when the parent dies. This will kill the child unless HUP handling is done, in which case the orphan gets adopted by init (PID 1). For more on SIGCHLD see perlipc and your local manpages man 7 signal.