Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.88k stars 530 forks source link

wait and waitpid can return -1 even when there are running child forks. #10360

Closed p5pRT closed 10 years ago

p5pRT commented 14 years ago

Migrated from rt.perl.org#74854 (status was 'resolved')

Searchable as RT74854$

p5pRT commented 14 years ago

From cems@mac.com

This is a bug report for perl from cems@​lanl.gov\, generated with the help of perlbug 1.39 running under perl v5.8.9.

FROM​: charlie strauss\, cems@​lanl.gov

perlbug​: wait and waitpid can return -1 even when there are running child forks. This happens any time a kill signal is sent to a previously reaped child process ID from inside the parent fork.

tested on platforms​:

1) mac osx 10.5.10 Darwin Kernel Version 9.8.0 perl v5.8.9 built for darwin-2level

2) Linux 2.6.31-20-generic #58-Ubuntu SMP

Expected behaviour​:

if a parent waits on children then I expect that 1) the wait() command should block till a child exists (or SIGCHLD). 2) the wait() command should never return -1 if there are unreaped or running children.

Observed behaviour​:

the above is normally true. But you can get wait() violate both those conditions very easily.
This happens any time a kill signal is sent to a previously reaped child process ID from inside the parent fork.

In order for the parent to be able to send a kill signal while it is waiting\, this has to happen from a signal handler that is triggered externally.

Steps to reproduce​:

see enclosed perl script demo.

basic flow is this​:

1) fork off two+ children whose jobs are different lengths​: e.g. sleep 1 and sleep 300 2) let the short running job be our $pid1 and the long running job be our $pid2. 3) set a %SIG signal handler for any signal like\, say sig-QUIT\, that sends a kill to our $pid1. 4) wait() for $pid1 to finish and get reaped by parent. 4) parent again waits() for $pid2 to finsish using $r=wait(); 5) send the parent a sigQUIT from another terminal or process. 6) result​: wait() unblocks and you find that $r is -1 but $pid2 is still running.

WHY THIS IS A PROBLEM​:
most perl man pages suggest a reaper that looks something like this​:

do {} while ( waitpid(-1\,WNOHANG) > 0 );

Simmilarly waits in parent processes generally look like​:

do {} while ( wait() > -1 ); exit;

or

do { sleep 1 } while ( waitpid(-1\,WNOHANG) > 0 ); exit;

However this fails due to above bug. waitpid and wait can return a -1 even when jobs are still running.

WORKAROUND​: the work around is to test the wait() value twice in a row when you get a -1.

do { wait() } while (waitpid(-1\,WNOHANG) > -1 );

this could also fail\, perhaps\, if multiple kill signals came too quickly for the loop to trap them.

DEMO SCRIPT

#!/usr/bin/perl -w use strict;

my @​command1 = ("sleep 360"); my @​command2 = ("sleep 2");

my $pid1 = fork();

unless ($pid1) {   exec @​command1;   };

my $pid2 = fork();

unless ($pid2) {   exec @​command2;   };

# THIS IS WHAT TRIGGERS THE BUG $SIG{CONT} = sub{ my $sig = $_[0]; kill $sig\, $pid2; warn " dead process $pid2 was sent $sig\n"};

# NEITHER OF THESE WILL TRIGGER THE BUG. thus the bug is due to sending a sigCONT to the dead process. #$SIG{CONT} = sub{ my $sig = $_[0]; kill $sig\, $pid1; warn "live process $pid1 was sent $sig\n"}; #$SIG{CONT} = sub{ my $sig = $_[0]; warn "did nothing with $sig\n"};

warn "processes running​:\n"; warn `ps au | grep $pid2 | grep -v grep` ; warn `ps au | grep $pid1 | grep -v grep` ;  
wait(); # reap process #2

warn "\n\ncommand @​command2 should have been reaped now\n"; warn "\nprocesses running​:\n"; my $r = `ps au | grep $pid2 | grep -v grep` ; warn $r if $r; warn `ps au | grep $pid1 | grep -v grep` ;

warn "\n\nHUMAN SLAVE​: To induce the bug\, pull up another terminal and type​:   kill -CONT $$ then   kill -CONT $$ then   kill -CONT $$ then   kill -CONT $$ then   kill -QUIT $pid1

(NOTICE the last one was $pid1 and not $$)\n";

warn "\n\nParent will first use wait()\n";
if ( wait() == -1 ) {warn "perl thinks the child process ended\, but did it?\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   }

warn "\n\nParent will next use waitpid()\n"; if ( waitpid(-1\,0) == -1 ) {warn "perl thinks the child process ended\, but did it?\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   }  
# here is the only way I know of to work around this bug​:

warn "\n\nParent is working around wait() bug by trapping it in a double waitpid wrapper\n"; while ( waitpid(-1\,1) > -1 ) { wait(); warn "perl wait() thinks the child process ended\, but we trapped this bug\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   } else { warn "\n\nThis time the process $pid1 really is ended for real!!!!\n"; warn "you can see this because waitpid is now -1​:"\, waitpid(-1\,1)\,"\n"; warn "and you can also see it is NOT in the process list​:"; warn `ps au | grep $pid1 | grep -v grep`; }


Flags​:   category=core   severity=high


Site configuration information for perl v5.8.9​:

Configured by cems at Wed Sep 16 16​:20​:28 MDT 2009.

Summary of my perl5 (revision 5 version 8 subversion 9) configuration​:   Platform​:   osname=darwin\, osvers=9.7.0\, archname=darwin-2level   uname='darwin ocho.lanl.gov 9.7.0 darwin kernel version 9.7.0​: tue mar 31 22​:52​:17 pdt 2009; root​:xnu-1228.12.14~1release_i386 i386 '   config_args='-des -D prefix=/opt/local -D scriptdir=/opt/local/bin -D cppflags=-I/opt/local/include -D ldflags=-L/opt/local/lib -D vendorprefix=/opt/local -D man1ext=1pm -D man3ext=3pm -D cc=/usr/bin/gcc-4.0 -D ld=/usr/bin/gcc-4.0 -D man1dir=/opt/local/share/man/man1p -D man3dir=/opt/local/share/man/man3p -D siteman1dir=/opt/local/share/man/man1 -D siteman3dir=/opt/local/share/man/man3 -D vendorman1dir=/opt/local/share/man/man1 -D vendorman3dir=/opt/local/share/man/man3 -D inc_version_list=5.8.8 5.8.8/darwin-2level -U i_bind -U i_gdbm -U i_db'   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef   use64bitint=undef use64bitall=undef uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='/usr/bin/gcc-4.0'\, ccflags ='-fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'\,   optimize='-O3'\,   cppflags='-I/opt/local/include -no-cpp-precomp -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'   ccversion=''\, gccversion='4.0.1 (Apple Inc. build 5493)'\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=16   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc-4.0'\, ldflags ='-L/opt/local/lib -L/usr/local/lib'   libpth=/usr/local/lib /opt/local/lib /usr/lib   libs=-ldbm -ldl -lm -lutil -lc   perllibs=-ldl -lm -lutil -lc   libc=/usr/lib/libc.dylib\, so=dylib\, useshrplib=false\, libperl=libperl.a   gnulibc_version=''   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=bundle\, d_dlsymun=undef\, ccdlflags=' '   cccdlflags=' '\, lddlflags='-L/opt/local/lib -bundle -undefined dynamic_lookup -L/usr/local/lib'

Locally applied patches​:  


@​INC for perl v5.8.9​:   /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level   /opt/local/lib/perl5/site_perl/5.8.9   /opt/local/lib/perl5/site_perl   /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level   /opt/local/lib/perl5/vendor_perl/5.8.9   /opt/local/lib/perl5/vendor_perl   /opt/local/lib/perl5/5.8.9/darwin-2level   /opt/local/lib/perl5/5.8.9   .


Environment for perl v5.8.9​:   DYLD_LIBRARY_PATH (unset)   HOME=/Users/cems   LANG (unset)   LANGUAGE (unset)   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=/Library/Frameworks/Python.framework/Versions/Current/bin​:/opt/local/bin​:/opt/local/sbin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/Library/Frameworks/Python.framework/Versions/Current/bin​:/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/local/bin​:/usr/X11/bin   PERL_BADLANG (unset)   SHELL=/bin/bash

p5pRT commented 10 years ago

From @tonycoz

On Sun May 02 12​:08​:18 2010\, cems@​mac.com wrote​:

This is a bug report for perl from cems@​lanl.gov\, generated with the help of perlbug 1.39 running under perl v5.8.9.

FROM​: charlie strauss\, cems@​lanl.gov

perlbug​: wait and waitpid can return -1 even when there are running child forks. This happens any time a kill signal is sent to a previously reaped child process ID from inside the parent fork.

tested on platforms​:

1) mac osx 10.5.10 Darwin Kernel Version 9.8.0 perl v5.8.9 built for darwin-2level

2) Linux 2.6.31-20-generic #58-Ubuntu SMP

Expected behaviour​:

if a parent waits on children then I expect that 1) the wait() command should block till a child exists (or SIGCHLD). 2) the wait() command should never return -1 if there are unreaped or running children.

I tested with your script under both Linux (3.2.0 kernel) and OS X 10.7.5 and in neither case did it report "Perl bug detected!!".

On OS X I tested the system perl 5.12.3 and bleadperl.

On Linux I tested 5.18.1 and bleadperl.

Does the problem still occur for you with a current perl?

Tony

p5pRT commented 10 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 10 years ago

From cems@mac.com

Blast from the past! Could you send me back my script and I'll test it if I can. I don't have that version of ubuntu or osx any longer.

On Sep 19\, 2013\, at 10​:49 PM\, Tony Cook via RT \perlbug\-followup@​perl\.org wrote​:

On Sun May 02 12​:08​:18 2010\, cems@​mac.com wrote​:

This is a bug report for perl from cems@​lanl.gov\, generated with the help of perlbug 1.39 running under perl v5.8.9.

FROM​: charlie strauss\, cems@​lanl.gov

perlbug​: wait and waitpid can return -1 even when there are running child forks. This happens any time a kill signal is sent to a previously reaped child process ID from inside the parent fork.

tested on platforms​:

1) mac osx 10.5.10 Darwin Kernel Version 9.8.0 perl v5.8.9 built for darwin-2level

2) Linux 2.6.31-20-generic #58-Ubuntu SMP

Expected behaviour​:

if a parent waits on children then I expect that 1) the wait() command should block till a child exists (or SIGCHLD). 2) the wait() command should never return -1 if there are unreaped or running children.

I tested with your script under both Linux (3.2.0 kernel) and OS X 10.7.5 and in neither case did it report "Perl bug detected!!".

On OS X I tested the system perl 5.12.3 and bleadperl.

On Linux I tested 5.18.1 and bleadperl.

Does the problem still occur for you with a current perl?

Tony

Charlie Strauss cems@​me.com

p5pRT commented 10 years ago

From @nwc10

On Fri\, Sep 20\, 2013 at 12​:03​:01AM -0600\, Charlie Strauss wrote​:

Blast from the past! Could you send me back my script and I'll test it if I can. I don't have that version of ubuntu or osx any longer.

The ticket is online at http​://rt.perl.org/rt3/Ticket/Display.html?id=74854

I've appended your script. I can't get it to print "Perl bug detected!!" with v5.8.9 (the version in your report) on either OS X 10.6 (one later than you had) or Linux gcc20 2.6.32-5-amd64 #1 SMP Mon Jan 16 16​:22​:28 UTC 2012 x86_64 GNU/Linux

I had hoped that I could get it to\, so that I could bisect to find what fixed the problem.

Nicholas Clark

#!/usr/bin/perl -w use strict;

my @​command1 = ("sleep 360"); my @​command2 = ("sleep 2");

my $pid1 = fork();

unless ($pid1) {   exec @​command1;   };

my $pid2 = fork();

unless ($pid2) {   exec @​command2;   };

# THIS IS WHAT TRIGGERS THE BUG $SIG{CONT} = sub{ my $sig = $_[0]; kill $sig\, $pid2; warn " dead process $pid2 was sent $sig\n"};

# NEITHER OF THESE WILL TRIGGER THE BUG. thus the bug is due to sending a sigCONT to the dead process. #$SIG{CONT} = sub{ my $sig = $_[0]; kill $sig\, $pid1; warn "live process $pid1 was sent $sig\n"}; #$SIG{CONT} = sub{ my $sig = $_[0]; warn "did nothing with $sig\n"};

warn "processes running​:\n"; warn `ps au | grep $pid2 | grep -v grep` ; warn `ps au | grep $pid1 | grep -v grep` ;  
wait(); # reap process #2

warn "\n\ncommand @​command2 should have been reaped now\n"; warn "\nprocesses running​:\n"; my $r = `ps au | grep $pid2 | grep -v grep` ; warn $r if $r; warn `ps au | grep $pid1 | grep -v grep` ;

warn "\n\nHUMAN SLAVE​: To induce the bug\, pull up another terminal and type​:   kill -CONT $$ then   kill -CONT $$ then   kill -CONT $$ then   kill -CONT $$ then   kill -QUIT $pid1

(NOTICE the last one was $pid1 and not $$)\n";

warn "\n\nParent will first use wait()\n";
if ( wait() == -1 ) {warn "perl thinks the child process ended\, but did it?\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   }

warn "\n\nParent will next use waitpid()\n"; if ( waitpid(-1\,0) == -1 ) {warn "perl thinks the child process ended\, but did it?\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   }  
# here is the only way I know of to work around this bug​:

warn "\n\nParent is working around wait() bug by trapping it in a double waitpid wrapper\n"; while ( waitpid(-1\,1) > -1 ) { wait(); warn "perl wait() thinks the child process ended\, but we trapped this bug\n";};

if ( kill 0\,$pid1) {   warn "\nPerl bug detected!! the process $pid1 is still running!!\n";   warn "you can see this because waitpid is now zero​:"\, waitpid(-1\,1)\,"\n";   warn "and you can also see it in the process list as active​:";   warn `ps au | grep $pid1 | grep -v grep`;   } else { warn "\n\nThis time the process $pid1 really is ended for real!!!!\n"; warn "you can see this because waitpid is now -1​:"\, waitpid(-1\,1)\,"\n"; warn "and you can also see it is NOT in the process list​:"; warn `ps au | grep $pid1 | grep -v grep`; }

p5pRT commented 10 years ago

From @cpansprout

On Fri Sep 20 01​:52​:42 2013\, nicholas wrote​:

On Fri\, Sep 20\, 2013 at 12​:03​:01AM -0600\, Charlie Strauss wrote​:

Blast from the past! Could you send me back my script and I'll test it if I can. I don't have that version of ubuntu or osx any longer.

The ticket is online at http​://rt.perl.org/rt3/Ticket/Display.html?id=74854

I've appended your script. I can't get it to print "Perl bug detected!!" with v5.8.9 (the version in your report) on either OS X 10.6 (one later than you had) or Linux gcc20 2.6.32-5-amd64 #1 SMP Mon Jan 16 16​:22​:28 UTC 2012 x86_64 GNU/Linux

I had hoped that I could get it to\, so that I could bisect to find what fixed the problem.

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

--

Father Chrysostomos

p5pRT commented 10 years ago

From @andk

"Father Chrysostomos via RT" \perlbug\-followup@​perl\.org writes​:

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

No need for slaves\, the answer is perl-5.8.8-990-g5f42405.

-- andreas

p5pRT commented 10 years ago

From @nwc10

On Fri\, Sep 20\, 2013 at 02​:22​:09PM +0200\, Andreas Koenig wrote​:

"Father Chrysostomos via RT" \perlbug\-followup@​perl\.org writes​:

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

No need for slaves\, the answer is perl-5.8.8-990-g5f42405.

Or this one in blead

commit 48dbb59ed9af112b035bdcc063c1471a22ec25a2 Author​: Steffen Ullrich \coyote\.frank@​gmx\.net Date​: Tue Feb 26 20​:43​:00 2008 +0100

  Re​: interrupting system() with signal depends on signal handler   Message-ID​: \47C45DB4\.9060306@​gmx\.net  
  p4raw-id​: //depot/perl@​33408

Inline Patch ```diff diff --git a/util.c b/util.c index 36166fb..82f147e 100644 --- a/util.c +++ b/util.c @@ -3011,6 +3011,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) #endif if (result < 0 && errno == EINTR) { PERL_ASYNC_CHECK(); + errno = EINTR; /* reset in case a signal handler changed $! */ } return result; } ```

However, there is still a long hang at the end of the test script at that revision\, whereas blead exits quickly.

I hope I can find that one.

Nicholas Clark

p5pRT commented 10 years ago

From @nwc10

On Fri\, Sep 20\, 2013 at 01​:29​:31PM +0100\, Nicholas Clark wrote​:

On Fri\, Sep 20\, 2013 at 02​:22​:09PM +0200\, Andreas Koenig wrote​:

"Father Chrysostomos via RT" \perlbug\-followup@&#8203;perl\.org writes​:

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

No need for slaves\, the answer is perl-5.8.8-990-g5f42405.

Or this one in blead

commit 48dbb59ed9af112b035bdcc063c1471a22ec25a2 Author​: Steffen Ullrich \coyote\.frank@&#8203;gmx\.net Date​: Tue Feb 26 20​:43​:00 2008 +0100

Re&#8203;: interrupting system\(\) with signal depends on signal handler
Message\-ID&#8203;:  \<47C45DB4\.9060306@&#8203;gmx\.net>

p4raw\-id&#8203;: //depot/perl@&#8203;33408

diff --git a/util.c b/util.c index 36166fb..82f147e 100644 --- a/util.c +++ b/util.c @​@​ -3011\,6 +3011\,7 @​@​ Perl_wait4pid(pTHX_ Pid_t pid\, int *statusp\, int flags) #endif if (result \< 0 && errno == EINTR) { PERL_ASYNC_CHECK(); + errno = EINTR; /* reset in case a signal handler changed $! */ } return result; }

However\, there is still a long hang at the end of the test script at that revision\, whereas blead exits quickly.

No\, it doesn't. Not sure why I thought that.

OK\, I think that this bug is resolved.

(But it's strange that it shows up in a (seeming) 5.8.9. perlbug from a different version from the tested version?)

Nicholas Clark

p5pRT commented 10 years ago

From @cpansprout

On Fri Sep 20 05​:22​:56 2013\, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

"Father Chrysostomos via RT" \perlbug\-followup@&#8203;perl\.org writes​:

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

No need for slaves\, the answer is perl-5.8.8-990-g5f42405.

Thank you. How did you manage that? With an Expect script?

--

Father Chrysostomos

p5pRT commented 10 years ago

From @andk

"Father Chrysostomos via RT" \perlbug\-followup@&#8203;perl\.org writes​:

Thank you. How did you manage that? With an Expect script?

No\, with a system() injected further up in the script. Here is the relevant change​:

- -unless ($pid1) { +if ($pid1) { +system "/bin/sh -c '(sleep 4 && kill -CONT $$ && kill -CONT $$ && kill -CONT $$ && kill -CONT $$ && kill -QUIT $pid1)' &"; +} else { exec @​command1; };

-- andreas

p5pRT commented 10 years ago

From @cpansprout

On Fri Sep 20 05​:35​:32 2013\, nicholas wrote​:

OK\, I think that this bug is resolved.

Then I will mark it as such until such time as someone proves otherwise. Thank you.

--

Father Chrysostomos

p5pRT commented 10 years ago

@cpansprout - Status changed from 'open' to 'resolved'

p5pRT commented 10 years ago

From cems@mac.com

I am no longer able to reproduce the bug in my current version of perl. I don't have either of the legacy set ups where it was a cross plat form reproducible bug. So I guess the signals /wait bug is gone.

here's the version I tested (stock apple build)

perl -V Summary of my perl5 (revision 5 version 12 subversion 4) configuration​:  
  Platform​:   osname=darwin\, osvers=12.0\, archname=darwin-thread-multi-2level   uname='darwin b1026.apple.com 12.0 darwin kernel version 12.0.0​: tue may 15 23​:31​:29 pdt 2012; root​:xnu-2050.6.70~1release_x86_64 x86_64 '   config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=clang'   hint=recommended\, useposix=true\, d_sigaction=define   useithreads=define\, usemultiplicity=define   useperlio=define\, d_sfio=undef\, uselargefiles=define\, usesocks=undef   use64bitint=define\, use64bitall=define\, uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='clang'\, ccflags ='-arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include'\,   optimize='-Os'\,   cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include'   ccversion=''\, gccversion='4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)'\, gccosandvers=''   intsize=4\, longsize=8\, ptrsize=8\, doublesize=8\, byteorder=12345678   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=16   ivtype='long'\, ivsize=8\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='clang -mmacosx-version-min=10.8'\, ldflags ='-arch i386 -arch x86_64 -fstack-protector -L/usr/local/lib'   libpth=/usr/local/lib /usr/lib   libs=-ldbm -ldl -lm -lutil -lc   perllibs=-ldl -lm -lutil -lc   libc=\, so=dylib\, useshrplib=true\, libperl=libperl.dylib   gnulibc_version=''   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=bundle\, d_dlsymun=undef\, ccdlflags=' '   cccdlflags=' '\, lddlflags='-arch i386 -arch x86_64 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:   Compile-time options​: MULTIPLICITY PERL_DONT_CREATE_GVSV   PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL   USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES   USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API   Locally applied patches​:   /Library/Perl/Updates/\ comes before system perl directories   installprivlib and installarchlib points to the Updates directory   Built under darwin   Compiled at Jun 20 2012 13​:55​:28   @​INC​:   /Library/Perl/5.12/darwin-thread-multi-2level   /Library/Perl/5.12   /Network/Library/Perl/5.12/darwin-thread-multi-2level   /Network/Library/Perl/5.12   /Library/Perl/Updates/5.12.4   /System/Library/Perl/5.12/darwin-thread-multi-2level   /System/Library/Perl/5.12   /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level   /System/Library/Perl/Extras/5.12

On Sep 20\, 2013\, at 6​:35 AM\, Nicholas Clark via RT \perlbug\-followup@&#8203;perl\.org wrote​:

On Fri\, Sep 20\, 2013 at 01​:29​:31PM +0100\, Nicholas Clark wrote​:

On Fri\, Sep 20\, 2013 at 02​:22​:09PM +0200\, Andreas Koenig wrote​:

"Father Chrysostomos via RT" \perlbug\-followup@&#8203;perl\.org writes​:

I get the bug on 5.8.8\, but not 5.8.9. Bisecting will take a long time\, as it requires a human slave.

No need for slaves\, the answer is perl-5.8.8-990-g5f42405.

Or this one in blead

commit 48dbb59ed9af112b035bdcc063c1471a22ec25a2 Author​: Steffen Ullrich \coyote\.frank@&#8203;gmx\.net Date​: Tue Feb 26 20​:43​:00 2008 +0100

Re​: interrupting system() with signal depends on signal handler Message-ID​: \47C45DB4\.9060306@&#8203;gmx\.net

p4raw-id​: //depot/perl@​33408

diff --git a/util.c b/util.c index 36166fb..82f147e 100644 --- a/util.c +++ b/util.c @​@​ -3011\,6 +3011\,7 @​@​ Perl_wait4pid(pTHX_ Pid_t pid\, int *statusp\, int flags) #endif if (result \< 0 && errno == EINTR) { PERL_ASYNC_CHECK(); + errno = EINTR; /* reset in case a signal handler changed $! */ } return result; }

However\, there is still a long hang at the end of the test script at that revision\, whereas blead exits quickly.

No\, it doesn't. Not sure why I thought that.

OK\, I think that this bug is resolved.

(But it's strange that it shows up in a (seeming) 5.8.9. perlbug from a different version from the tested version?)

Nicholas Clark

Charlie Strauss cems@​me.com