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

new taint tests cause hang on threaded FreeBSD

Thread Next
From:
Nicholas Clark
Date:
April 25, 2006 09:59
Subject:
new taint tests cause hang on threaded FreeBSD
Message ID:
20060425165855.GS45236@plum.flirble.org
The new taint tests

{   
    SKIP: {
        skip "fork() is not available", 3 unless $Config{'d_fork'};

        $ENV{'PATH'} = $TAINT;
        local $SIG{'PIPE'} = 'IGNORE';
        eval {
            my $pid = open my $pipe, '|-';
            if (!defined $pid) {
                die "open failed: $!";
            }
            if (!$pid) {
                kill 'KILL', $$;        # child suicide
            }
            close $pipe;
        };


cause perl on FreeBSD with ithreads to hang with a busy loop sometimes.
(Verified on 5.3 and 6.1-PRERELEASE).

The hang is inside waitpid inside Perl_wait4pid, line 2803 of util.c:

    result = PerlProc_waitpid(pid,statusp,flags);
    goto finish;

which is that C<close $pipe>

This appears to be a FreeBSD bug rather than a Perl bug. I'm wondering if it's
present in other *BSDs, and if anyone's smokes are hanging.

Running ktrace ./perl -T t/op/taint.t makes the problem go away.
Attaching ktrace to a running (hung) process shows it looping like this:

61561 perl     CALL  gettimeofday(0x282e8d18,0)
61561 perl     RET   gettimeofday 0
61561 perl     CALL  poll(0x8277000,0x1,0xffffffff)
61561 perl     RET   poll 1


I'm not sure what we can do about this, apart from skip those tests on FreeBSD.

I've attached the smallest test case I can get it to.

Nicholas Clark

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