Hi there
I'm dealing with some very odd behaviour as I migrate a process of mine from perl 5.8.8 to perl 5.12.1
I have created a small script (pasted below) that reproduces the problem; what seems to be happening is that the require statement of the module Vip.pm, which contains:
use Net::DNS; my $resolver = new Net::DNS::Resolver();causes the SIG{CHLD} handler to be reset in some way when running on perl 5.12.1, which results in an error.
But on 5.8.8 the SIG{CHLD} handler is unchanged after the require statement.
If I add "use Net::DNS::Resolver;" at the top of the mytest.pl script (but leave the require as-is), then the output of the script on perl v 5.12.1 becomes the same as 5.8.8 (the signal handler remains unchanged)
Also, if I change Vip.pm to require another module (e.g. Digest::MD5), I don't get this behaviour, the output of the script on perl v5.12.1 and 5.8.8 is again the same (signal handler remains unchanged)
Finally, the error (when running on perl 5.12.1) appears as below in my reproducer script, but when running in my actual process appears as:
"Signal SIGCHLD received, but no signal handler set."I'm running on Red Hat Enterprise Linux Server release 5.11
Here's the output of my program on perl v5.8.8
-----------------------------------------------
Before setting SIG{CHLD} its value is...<br/> $VAR1 = undef;<br/> After setting SIG{CHLD} its value is...<br/> $VAR1 = sub { "DUMMY" };<br/> After require statement SIG{CHLD} value is...<br/> $VAR1 = sub { "DUMMY" };<br/> Calling ping now...<br/> I AM A SIG{CHLD} handler<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> DONE
Here's the output of my program on perl v5.12.1
---------------------------------------------
Before setting SIG{CHLD} its value is...<br/> $VAR1 = undef;<br/> After setting SIG{CHLD} its value is...<br/> $VAR1 = sub { "DUMMY" };<br/> After require statement SIG{CHLD} value is...<br/> $VAR1 = undef;<br/> Calling ping now...<br/> Reading ping stream...<br/> Use of uninitialized value in iteration finalizer at mytest.pl line 21 +, <PING> line 1.<br/> Unable to create sub named "" at mytest.pl line 21, <PING> line 1.</p>
Here is the code in my test script:
------------------------------------
use strict; use warnings; use Data::Dumper; use POSIX; print "Before setting SIG{CHLD} its value is...\n"; print Dumper($SIG{CHLD}); $SIG{CHLD}= \&REAPER; print "After setting SIG{CHLD} its value is...\n"; print Dumper($SIG{CHLD}); require Error::Vip; print "After require statement SIG{CHLD} value is...\n"; print Dumper($SIG{CHLD}); print "Calling ping now...\n"; my @cmd = ('ping', '-c', 1, '-n', '-A', '-W', 1, "164.55.89.62"); open (PING, '-|', @cmd) or confess("Can't ping -- $!"); while (my $ping = <PING>) { print "Reading ping stream...\n"; } close PING; print "DONE\n"; sub REAPER { print "I AM A SIG{CHLD} handler\n" }
Here's the code in Error/Vip.pm
-------------------------------
package Error::Test; use strict; use warnings; use Net::DNS; my $resolver = new Net::DNS::Resolver(); 1;
In reply to SIG{CHLD} altered by require statement on Perl 5.12.1 by sdingare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |