Skip Menu |
 

This queue is for tickets about the forks CPAN distribution.

Report information
The Basics
Id: 123248
Status: open
Priority: 0/
Queue: forks

People
Owner: Nobody in particular
Requestors: s.harper [...] utah.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
Download (untitled) / with headers
text/plain 2.3k
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
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 903b
Dne St 11.říj.2017 13:12:08, s.harper@utah.edu napsal(a): Show quoted text
> 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.
This is issue even with latest Perl 5.26.1. It happens since this perl commit <https://perl5.git.perl.org/perl.git/patch/facf34ef484d62d15b2da11ee03d01942a22ff15>. The reproducer crashes when calling threads->isthread(). The Perl commit unshares a hash in File::Glob::CLONE(). forks module documents that forks' cloning behaves differently from threads, especially around hashes ("Module CLONE & CLONE_SKIP functions and threads "section). And threads->isthread() actually calls _init_thread( _run_CLONE_SKIP(), ...). I think the problem lies somewhere here.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.