develooper Front page | perl.perl5.porters | Postings from April 2004

FileCache 1.03 (as per 5.8.3) breaks system()

Thread Next
From:
Alan Burlison
Date:
April 16, 2004 06:41
Subject:
FileCache 1.03 (as per 5.8.3) breaks system()
Message ID:
407FD5F1.4070401@sun.com
$ perl -e 'print(system("true"), " $!\n")';
0
perl -MFileCache -e 'print(system("true"), " $!\n")';
-1 No child processes
$

FileCache does the following:

# Reap our children
${"$pkg\::SIG"}{'CLD'}  = 'IGNORE' if $Config{sig_name} =~ /\bCLD\b/;
${"$pkg\::SIG"}{'CHLD'} = 'IGNORE' if $Config{sig_name} =~ /\bCHLD\b/;
${"$pkg\::SIG"}{'PIPE'} = 'IGNORE' if $Config{sig_name} =~ /\bPIPE\b/;

This is a VMS-safe version of the original change made by Jerrad in 
Change 19770:

# Reap our children
@{"$pkg\::SIG"}{'CLD', 'CHLD', 'PIPE'} = ('IGNORE')x3;

As Rafael pointed out to me, that's wrong anyway as %SIG is in main::. 
The other side-effect is that by ignoring SIGCHLD the waitid() done by 
system() fails:

pipe()						= 3 [4]
fork1()						= 102184
lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000) = 0xFFFFFFFFFFBFFEFF 
[0x0000FFFF]
close(4)					= 0
sigaction(SIGINT, 0xFFBFE870, 0xFFBFE9C0)	= 0
sigaction(SIGQUIT, 0xFFBFE870, 0xFFBFE9A0)	= 0
waitid(P_PID, 102184, 0xFFBFE7F0, WEXITED|WTRAPPED) Err#10 ECHILD

The FileCache docs contain the following:

----------
FileCache installs signal handlers for CHLD (a.k.a. CLD) and PIPE in the
calling package to handle deceased children from 2-arg C<cacheout> with 
C<'|-'> or C<'-|'> I<expediently>. The children would otherwise be 
reaped eventually, unless you terminated before repeatedly calling cacheout.
----------

That's as maybe, but breaking system() as a consequence doesn't seem 
like a reasonable tradeoff.  This bug has broken part of our HPC 
ClusterTools package, so I'm interested in finding a resolution.

-- 
Alan Burlison
--


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About