Subject: | File-Glob patch to make thread safe causes forks to segfault |
Date: | Wed, 11 Oct 2017 11:10:46 -0600 |
To: | bug-forks [...] rt.cpan.org |
From: | Steve Harper <s.harper [...] utah.edu> |
In these perl tickets ( [perl #119897] and [perl #117823]) a patch to
make File::Glob thread safe is discussed. We first noticed this problem
on Centos 7.3 with Perl 5.16.3-291, and also tested with the latest
softwarecollections.org rh-perl524, both of which segfault. We tested
with the latest forks module available, 0.36. Here is the test code we
wrote
forktest.pl:
#!/usr/bin/perl
use forks qw(debug);
use strict;
use warnings;
threads->debug( 1 );
#file glob appears to initiate trigger1
my @files = <'./*'>;
#launch fork
my $fid = fork();
#only fork will go into here
if(!$fid){
threads->isthread; #make into independent detatched thread
threads->exit(0);
}
#capture segfault from now zombie fork
local $?; #localize to avoid altering exit status
waitpid($fid, 0);
my $stat = $?; #exit status of fork
warn "ERROR: Fork died with status $stat...\n" if($stat != 0);
exit(0);
expected results:
? < _set_tid 1
1 > _register_pid 1 6245 1
1 < 1
1 > _shutdown 1
1 < 1
0 > _toexit
0 < 1
0 > _shutdown
Actual results:
Argument "2.56_01" isn't numeric in numeric ge (>=) at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 1570.
? < _set_tid 1
1 > _register_pid 1 14106 1
ERROR: Fork died with status 139...
0 > _toexit
Performing cleanup for dead thread 1: Error 104: Could not read length of message from 1: Connection reset by peer at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 1866.
threads::_cleanup_unsafe_thread_exit(1, "Error 104: Could not read length of message from 1: Connectio"...) called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 2343
threads::_length(IO::Socket::INET=GLOB(0xe17548)) called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 1650
threads::_server called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 1370
threads::_init_server() called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 1295
threads::_init() called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 503
require forks.pm called at forktest.pl line 3
main::BEGIN() called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 0
eval {...} called at /opt/rh/rh-perl524/root/usr/local/lib64/perl5/forks.pm line 0
0 < 1
0 > _shutdown
Thanks for your attention,
Steve Harper
Sr Sys Admin
Center for High Performance Computing
University of Utah