Skip Menu |
Report information
Id: 119097
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: vsespb <victor [at] vsespb.ru>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: HasPatch
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



Subject: print returning EINTR in 5.14
Date: Wed, 31 Jul 2013 23:30:25 +0400
To: perlbug [...] perl.org
From: Victor Efimov <victor [...] vsespb.ru>
Download (untitled) / with headers
text/plain 3.3k
Test case:

Show quoted text
#!/usr/bin/env perl

use strict;
use warnings;
use utf8;
use Test::More tests => 20;
use Time::HiRes qw/usleep ualarm/;
use IO::Pipe;


local $SIG{ALRM} = sub { print STDERR "ALRM $$\n" };
my $sample = 'abxhrtf6';
my $full_sample = 'abxhrtf6' x (8192-7);
my $sample_l = length $full_sample;

my $ppid = $$;
my $fh = new IO::Pipe;

if (my $pid = fork()) {
    my $child_exited = 0;
    $fh->reader();
    $fh->autoflush(1);
    $fh->blocking(1);
    binmode $fh, ":perlio";

    usleep 100_000;
    for (1..10) {
        my $n = read($fh, my $x, $sample_l);
        die "EOF" unless $n;
        is $n, $sample_l, "should return right amount of data";
        ok $x eq $full_sample, "should return right data"
    }

    while(wait() != -1 ){};
} else {
    $fh->writer();
    $fh->autoflush(1);
    $fh->blocking(1);
    binmode $fh, ":perlio";

    for (1..10) {
        ualarm(10_000);
        while ( !print($fh $full_sample) && $!{EINTR} ) { print STDERR "print failed: [ $! ]\n" };
        ualarm(0);
    }

    exit(0);
}

1;

__END__


Works fine under all perls ( Linux ), except perl-5.14

when works fine:

1..20
ALRM 32265
ok 1 - should return right amount of data
ok 2 - should return right data
ok 3 - should return right amount of data
ok 4 - should return right data
ok 5 - should return right amount of data
ok 6 - should return right data
ok 7 - should return right amount of data
ok 8 - should return right data
ok 9 - should return right amount of data
ok 10 - should return right data
ok 11 - should return right amount of data
ok 12 - should return right data
ok 13 - should return right amount of data
ok 14 - should return right data
ok 15 - should return right amount of data
ok 16 - should return right data
ok 17 - should return right amount of data
ok 18 - should return right data
ok 19 - should return right amount of data
ok 20 - should return right data


in 5.14:

1..20
ALRM 2058
print failed: [ Interrupted system call ]
print failed: [ Interrupted system call ]
ok 1 - should return right amount of data
ok 2 - should return right data
print failed: [ Interrupted system call ]
ok 3 - should return right amount of data
ok 4 - should return right data
print failed: [ Interrupted system call ]
ok 5 - should return right amount of data
ok 6 - should return right data
print failed: [ Interrupted system call ]
ok 7 - should return right amount of data
ok 8 - should return right data
print failed: [ Interrupted system call ]
ok 9 - should return right amount of data
ok 10 - should return right data
print failed: [ Interrupted system call ]
ok 11 - should return right amount of data
ok 12 - should return right data
print failed: [ Interrupted system call ]
ok 13 - should return right amount of data
ok 14 - should return right data
print failed: [ Interrupted system call ]
ok 15 - should return right amount of data
ok 16 - should return right data
print failed: [ Interrupted system call ]
ok 17 - should return right amount of data
ok 18 - should return right data
ok 19 - should return right amount of data
ok 20 - should return right data
print failed: [ Interrupted system call ]
^C

so print returns undef + EINTR, and even if restart print operation, it hangs, with both :perlio or :raw mode.

possible similar issue: http://www.perlmonks.org/?node_id=1026542

I wonder if this a bug, maybe a fix should be backported, or a test case created.

Subject: Re: [perl #119097] print returning EINTR in 5.14
Date: Wed, 31 Jul 2013 23:39:27 +0100
To: perl5-porters [...] perl.org
From: Dave Mitchell <davem [...] iabyn.com>
Download (untitled) / with headers
text/plain 566b
On Wed, Jul 31, 2013 at 12:30:58PM -0700, Victor Efimov wrote: (stuff about EINTR) Show quoted text
> I wonder if this a bug, maybe a fix should be backported, or a test case > created.
This was fixed in 5.15.4 with the following commit. It's unlikely to to be back-ported to 5.14.x, since that branch is now end-of-life. commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 Author: Chip <chip@pobox.com> Date: Mon Sep 19 23:51:49 2011 -0700 add a couple missing LEAVEs in perlio_async_run() -- Justice is when you get what you deserve. Law is when you get what you pay for.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 774b
Ok, what if I try to rework this poc code as test case, and submit as patch? Seems this code fails also on 5.8.x (probably different reason), and commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 does not contain test. On Wed Jul 31 15:40:17 2013, davem wrote: Show quoted text
> On Wed, Jul 31, 2013 at 12:30:58PM -0700, Victor Efimov wrote: > (stuff about EINTR)
> > I wonder if this a bug, maybe a fix should be backported, or a test case > > created.
> > This was fixed in 5.15.4 with the following commit. It's unlikely to to > be back-ported to 5.14.x, since that branch is now end-of-life. > > > commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 > Author: Chip <chip@pobox.com> > Date: Mon Sep 19 23:51:49 2011 -0700 > > add a couple missing LEAVEs in perlio_async_run() >
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 342b
On Wed Jul 31 16:10:43 2013, vsespb wrote: Show quoted text
> Ok, what if I try to rework this poc code as test case, and submit as
patch? Show quoted text
> > Seems this code fails also on 5.8.x (probably different reason), and > commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 does not contain test.
If you could, that would be much appreciated. -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 396b
patch attached On Wed Jul 31 17:58:23 2013, sprout wrote: Show quoted text
> On Wed Jul 31 16:10:43 2013, vsespb wrote:
> > Ok, what if I try to rework this poc code as test case, and submit as
> patch?
> > > > Seems this code fails also on 5.8.x (probably different reason), and > > commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 does not contain test.
> > If you could, that would be much appreciated. >
From 39e247562f389ff1f0c27913f782df0d512ccfd9 Mon Sep 17 00:00:00 2001 From: Victor <victor@vsespb.ru> Date: Fri, 2 Aug 2013 14:39:59 +0400 Subject: [PATCH] Print and EINTR test Test that print() is not returning EINTR, fails under 5.14.x ( see https://rt.perl.org/rt3/Ticket/Display.html?id=119097 ) also fails under 5.8.x Currently test enabled on linux/bsd/solaris/darwin --- t/io/eintr_print.t | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 87 insertions(+), 0 deletions(-) create mode 100644 t/io/eintr_print.t diff --git a/t/io/eintr_print.t b/t/io/eintr_print.t new file mode 100644 index 0000000..56ab5b4 --- /dev/null +++ b/t/io/eintr_print.t @@ -0,0 +1,87 @@ +#!./perl + +# print should not return EINTR +# fails under 5.14.x see https://rt.perl.org/rt3/Ticket/Display.html?id=119097 +# also fails under 5.8.x + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use strict; +use warnings; + +use Config; +use Time::HiRes; +use IO::Handle; + +require './test.pl'; + +skip_all("only for dev versions for now") if ((int($]*1000) & 1) == 0); +skip_all("does not match platform whitelist") + unless ($^O =~ /^(linux|.*bsd|darwin|solaris)$/); +skip_all("ualarm() not implemented on this platform") + unless Time::HiRes::d_ualarm(); +skip_all("usleep() not implemented on this platform") + unless Time::HiRes::d_usleep(); +skip_all("pipe not implemented on this platform") + unless eval { pipe my $in, my $out; 1; }; + +my $sample = 'abxhrtf6'; +my $full_sample = 'abxhrtf6' x (8192-7); +my $sample_l = length $full_sample; + +my $ppid = $$; + +pipe my $in, my $out; + +my $small_delay = 10_000; +my $big_delay = $small_delay * 3; +my $fail_delay = 20_000_000; + +if (my $pid = fork()) { + plan(tests => 20); + + local $SIG{ALRM} = sub { print STDERR "FAILED $$\n"; exit(1) }; + my $child_exited = 0; + $in->autoflush(1); + $in->blocking(1); + binmode $in, ":perlio"; + + Time::HiRes::usleep $big_delay; + + # in case test fail it should not hang, however this is not always helping + Time::HiRes::ualarm($fail_delay); + for (1..10) { + my $n = read($in, my $x, $sample_l); + die "EOF" unless $n; + + # should return right amount of data + is($n, $sample_l); + + # should return right data + # don't use "is()" as output in case of fail is big and useless + ok($x eq $full_sample); + } + Time::HiRes::ualarm(0); + + while(wait() != -1 ){}; +} else { + local $SIG{ALRM} = sub { print "# ALRM $$\n" }; + $out->autoflush(1); + $out->blocking(1); + binmode $out, ":perlio"; + + for (1..10) { # on some iteration print() will block + Time::HiRes::ualarm($small_delay); # and when it block we'll get SIGALRM + # it should unblock and continue after $big_delay + die "print failed [ $! ]" unless print($out $full_sample); + Time::HiRes::ualarm(0); + } + + exit(0); +} + +1; + -- 1.7.0.4
CC: perl5-porters [...] perl.org
Subject: Re: [perl #119097] print returning EINTR in 5.14
Date: Thu, 8 Aug 2013 09:58:19 +0100
To: Victor Efimov via RT <perlbug-followup [...] perl.org>
From: Nicholas Clark <nick [...] ccl4.org>
Download (untitled) / with headers
text/plain 1.1k
On Fri, Aug 02, 2013 at 03:43:07AM -0700, Victor Efimov via RT wrote: Show quoted text
> patch attached > > On Wed Jul 31 17:58:23 2013, sprout wrote:
> > On Wed Jul 31 16:10:43 2013, vsespb wrote:
> > > Ok, what if I try to rework this poc code as test case, and submit as
> > patch?
> > > > > > Seems this code fails also on 5.8.x (probably different reason), and > > > commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 does not contain test.
> > > > If you could, that would be much appreciated. > >
I've added the file to MANIFEST, edited the commit message slightly: commit 4a7b8c665e85a42957110900dd00dd5accaf9e46 Author: Victor <victor@vsespb.ru> Date: Fri Aug 2 14:39:59 2013 +0400 Test that print() is not returning EINTR. fails under 5.14.x ( see RT #119097 ) also fails under 5.8.x Currently test enabled on linux/bsd/solaris/darwin MANIFEST | 1 + t/io/eintr_print.t | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 0 deletions(-) and pushed it to smoke-me/nicholas/rt-119097 I admit that I *haven't* actually looked closely at the code. Nicholas Clark
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 3.2k
On Thu Aug 08 01:58:52 2013, nicholas wrote: Show quoted text
> On Fri, Aug 02, 2013 at 03:43:07AM -0700, Victor Efimov via RT wrote:
> > patch attached > > > > On Wed Jul 31 17:58:23 2013, sprout wrote:
> > > On Wed Jul 31 16:10:43 2013, vsespb wrote:
> > > > Ok, what if I try to rework this poc code as test case, and
> submit as
> > > patch?
> > > > > > > > Seems this code fails also on 5.8.x (probably different reason),
> and
> > > > commit be48bbe8d671b6841c3ec7cb734b98071afe3cd9 does not contain
> test.
> > > > > > If you could, that would be much appreciated. > > >
> > I've added the file to MANIFEST, edited the commit message slightly: > > commit 4a7b8c665e85a42957110900dd00dd5accaf9e46 > Author: Victor <victor@vsespb.ru> > Date: Fri Aug 2 14:39:59 2013 +0400 > > Test that print() is not returning EINTR. > > fails under 5.14.x ( see RT #119097 ) > also fails under 5.8.x > > Currently test enabled on linux/bsd/solaris/darwin > > MANIFEST | 1 + > t/io/eintr_print.t | 87 > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 88 insertions(+), 0 deletions(-) > > > and pushed it to smoke-me/nicholas/rt-119097 > > > I admit that I *haven't* actually looked closely at the code.
This test has blocked one of my darwin smokers, but doesn't appear to block every time: bash-3.2$ ps w PID TT STAT TIME COMMAND 1466 s000 Ss 0:00.02 -bash 1788 s000 S+ 0:00.84 screen -S smoke 1794 s001 S 0:00.02 bash 1806 s001 S+ 0:00.53 perl /Users/perlsmoke/bin/smoke-me-smoker.pl smoke.cfg 1899 s001 S+ 0:00.00 sh -c cd /Users/perlsmoke/smoke-me/smoke && ./smokecurrent.sh -nosmartsmoke -nomail </dev/null 1900 s001 SN+ 0:00.01 /bin/sh ./smokecurrent.sh -nosmartsmoke -nomail 1902 s001 SN+ 0:01.43 /usr/bin/perl ./smokeperl.pl -c smokecurrent_config -nosmartsmoke -nomail 17935 s001 SN+ 0:00.14 make test_harness 21640 s001 SN+ 0:00.00 /bin/sh -e ./runtests choose 21642 s001 SN+ 0:40.22 ./perl harness 22314 s001 SN+ 0:00.04 ./perl -I.. -MTestInit io/eintr_print.t 22315 s001 ZN+ 0:00.00 (perl) 58632 s002 S 0:00.02 bash bash-3.2$ ./smokestatus.pl -am Checking status for configuration 'smokecurrent_config' (5.11.x) Change number 4a7b8c665e85a42957110900dd00dd5accaf9e46 started on Fri Aug 9 10:54:54 2013. 1 out of 16 configurations finished in 1 day 21 hours 44 minutes. 1 configuration showed failures (F). 0 failures in the running configuration. 15 configurations to finish, estimated completion in 28 days 13 hours 53 minutes Average smoke duration: 1 day 21 hours 44 minutes. Matrix, using cc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00): v5.19.2-316-g4a7b8c6 Configuration (common) none ----------- --------------------------------------------------------- F O ? - | | | +----- PERLIO = perlio -DDEBUGGING | | +------- PERLIO = stdio -DDEBUGGING | +--------- PERLIO = perlio +----------- PERLIO = stdio bash-3.2$ uname -a Darwin pallas.tony.develop-help.com 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 The F is from me killing the first blockage. Running the test directly and via harness in a loop a few hundred times didn't block. Tony
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 199b
On Sat Aug 10 15:51:13 2013, tonyc wrote: Show quoted text
> This test has blocked one of my darwin smokers, but doesn't appear to > block every time:
It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2. Tony
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 467b
hm, that's sad :( i've tested it for stability like this on Linux x86-64 and OpenBSD: ( seq 10000 |xargs -P 100 -n 1 ./perl t/io/eintr_print.t ) && echo ALL_FINE (i.e. 100 concurrent runs) and it was fine. On Sat Aug 10 17:02:36 2013, tonyc wrote: Show quoted text
> On Sat Aug 10 15:51:13 2013, tonyc wrote:
> > This test has blocked one of my darwin smokers, but doesn't appear to > > block every time:
> > It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2. > > Tony
RT-Send-CC: perl5-porters [...] perl.org
Seems it hangs (in 100% of cases) when PERLIO=stdio can be fixed with skip_all("not supposed to work with stdio") if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ); similar code exits in eintr.t: # XXX for some reason the stdio layer doesn't seem to interrupt # write system call when the alarm triggers. This makes the tests # hang. if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ) { skip_all('stdio not supported for this script'); exit 0; } On Sun Aug 11 01:19:12 2013, vsespb wrote: Show quoted text
> hm, that's sad :( i've tested it for stability like this on Linux x86-64 > and OpenBSD: > > ( seq 10000 |xargs -P 100 -n 1 ./perl t/io/eintr_print.t ) && echo
ALL_FINE Show quoted text
> > (i.e. 100 concurrent runs) and it was fine. > > On Sat Aug 10 17:02:36 2013, tonyc wrote:
> > On Sat Aug 10 15:51:13 2013, tonyc wrote:
> > > This test has blocked one of my darwin smokers, but doesn't appear to > > > block every time:
> > > > It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2. > > > > Tony
> >
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.4k
Also, (1) http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29 Show quoted text
> the solution is to use the :perlio layer to do IO--at least on those
handles that you want to be able to break into with signals. http://perldoc.perl.org/PerlIO.html Show quoted text
> The default can be overridden by setting the environment variable
PERLIO to a space separated list of layers it seems that the test initially had binmode $fh, ":perlio"; but PERLIO=stdio overrides this. so phrase "The default can be overridden by setting the environment variable PERLIO" does not look correct. Not only default is overriden, but any atempt to use the layer. (2) There is a ticket related to eintr.t https://rt.perl.org/rt3/Ticket/Display.html?id=85842 Long story short (my understanding): 1. Commit http://perl5.git.perl.org/perl.git/commit/b83080de5c4254 introduce eintr.t problems under freebsd and some solaris versions 2. Those OS blacklisted in eintr.t 3. It still has problems on older linuxes 4. According to this comment https://rt.perl.org/rt3/Ticket/Display.html?id=84688#txn-871204 any (or some) IO in signal handler can be a problem, however it should not (according to perlipc) So, according to this ticket it might be a good idea to: a) copy OS blacklist from eintr.t to eintr_print.t b) remove 'print "# ALRM $$\n"' from $SIG{ALRM} On Sun Aug 11 02:41:44 2013, vsespb wrote: Show quoted text
> Seems it hangs (in 100% of cases) when PERLIO=stdio > > can be fixed with > > skip_all("not supposed to work with stdio") > if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ); > > similar code exits in eintr.t: > > # XXX for some reason the stdio layer doesn't seem to interrupt > # write system call when the alarm triggers. This makes the tests > # hang. > > if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ) { > skip_all('stdio not supported for this script'); > exit 0; > } > > > > On Sun Aug 11 01:19:12 2013, vsespb wrote:
> > hm, that's sad :( i've tested it for stability like this on Linux x86-64 > > and OpenBSD: > > > > ( seq 10000 |xargs -P 100 -n 1 ./perl t/io/eintr_print.t ) && echo
> ALL_FINE
> > > > (i.e. 100 concurrent runs) and it was fine. > > > > On Sat Aug 10 17:02:36 2013, tonyc wrote:
> > > On Sat Aug 10 15:51:13 2013, tonyc wrote:
> > > > This test has blocked one of my darwin smokers, but doesn't
appear to Show quoted text
> > > > block every time:
> > > > > > It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2. > > > > > > Tony
> > > >
> >
CC: perl5-porters [...] perl.org
Subject: Re: [perl #119097] print returning EINTR in 5.14
Date: Sun, 11 Aug 2013 15:54:57 +0300
To: perlbug-followup [...] perl.org
From: Leon Timmermans <fawaka [...] gmail.com>
Download (untitled) / with headers
text/plain 1.2k
On Sun, Aug 11, 2013 at 3:18 PM, Victor Efimov via RT <perlbug-followup@perl.org> wrote: Show quoted text
> Also, > > (1) > > http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29
>> the solution is to use the :perlio layer to do IO--at least on those
> handles that you want to be able to break into with signals. > > http://perldoc.perl.org/PerlIO.html
>> The default can be overridden by setting the environment variable
> PERLIO to a space separated list of layers > > it seems that the test initially had > binmode $fh, ":perlio";
binmode $fh, ":perlio" is conceptually nonsensical. You want to specify that during open, but that's broken too :-/ Show quoted text
> but PERLIO=stdio overrides this. > so phrase "The default can be overridden by setting the environment > variable PERLIO" does not look correct. Not only default is overriden, > but any atempt to use the layer.
No, it doesn't. What you're doing is effectively both: ":stdio:perlio". This will generally block unless you're reading the buffer size(Because :perlio is assuming read sementics underneath it, not fread semantics). This is a known issue that can't be fixed (stdio just sucks like that). You can kind of fix it with a «use open IO => ":pop:perlio";», it isn't pretty but I'm not sure what else would do the trick. PerlIO sucks like that. Leon
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
ok, so easier just to skip_all("not supposed to work with stdio") if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ); like eintr.t does On Sun Aug 11 05:55:55 2013, LeonT wrote: Show quoted text
> On Sun, Aug 11, 2013 at 3:18 PM, Victor Efimov via RT > <perlbug-followup@perl.org> wrote:
> > Also, > > > > (1) > > > > http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29
> >> the solution is to use the :perlio layer to do IO--at least on those
> > handles that you want to be able to break into with signals. > > > > http://perldoc.perl.org/PerlIO.html
> >> The default can be overridden by setting the environment variable
> > PERLIO to a space separated list of layers > > > > it seems that the test initially had > > binmode $fh, ":perlio";
> > binmode $fh, ":perlio" is conceptually nonsensical. You want to > specify that during open, but that's broken too :-/ >
> > but PERLIO=stdio overrides this. > > so phrase "The default can be overridden by setting the environment > > variable PERLIO" does not look correct. Not only default is overriden, > > but any atempt to use the layer.
> > No, it doesn't. What you're doing is effectively both: > ":stdio:perlio". This will generally block unless you're reading the > buffer size(Because :perlio is assuming read sementics underneath it, > not fread semantics). This is a known issue that can't be fixed (stdio > just sucks like that). > > You can kind of fix it with a �use open IO => ":pop:perlio";�, it > isn't pretty but I'm not sure what else would do the trick. PerlIO > sucks like that. > > Leon >
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.6k
attaching fixes to eintr_print.t On Sun Aug 11 05:18:43 2013, vsespb wrote: Show quoted text
> Also, > > (1) > > http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29
> > the solution is to use the :perlio layer to do IO--at least on those
> handles that you want to be able to break into with signals. > > http://perldoc.perl.org/PerlIO.html
> > The default can be overridden by setting the environment variable
> PERLIO to a space separated list of layers > > it seems that the test initially had > binmode $fh, ":perlio"; > > but PERLIO=stdio overrides this. > so phrase "The default can be overridden by setting the environment > variable PERLIO" does not look correct. Not only default is overriden, > but any atempt to use the layer. > > (2) > > There is a ticket related to eintr.t > https://rt.perl.org/rt3/Ticket/Display.html?id=85842 > Long story short (my understanding): > > 1. Commit http://perl5.git.perl.org/perl.git/commit/b83080de5c4254 > introduce eintr.t problems under freebsd and some solaris versions > 2. Those OS blacklisted in eintr.t > 3. It still has problems on older linuxes > 4. According to this comment > https://rt.perl.org/rt3/Ticket/Display.html?id=84688#txn-871204 > any (or some) IO in signal handler can be a problem, however it should > not (according to perlipc) > > So, according to this ticket it might be a good idea to: > a) copy OS blacklist from eintr.t to eintr_print.t > b) remove 'print "# ALRM $$\n"' from $SIG{ALRM} > > > > > On Sun Aug 11 02:41:44 2013, vsespb wrote:
> > Seems it hangs (in 100% of cases) when PERLIO=stdio > > > > can be fixed with > > > > skip_all("not supposed to work with stdio") > > if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ); > > > > similar code exits in eintr.t: > > > > # XXX for some reason the stdio layer doesn't seem to interrupt > > # write system call when the alarm triggers. This makes the tests > > # hang. > > > > if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ) { > > skip_all('stdio not supported for this script'); > > exit 0; > > } > > > > > > > > On Sun Aug 11 01:19:12 2013, vsespb wrote:
> > > hm, that's sad :( i've tested it for stability like this on Linux
x86-64 Show quoted text
> > > and OpenBSD: > > > > > > ( seq 10000 |xargs -P 100 -n 1 ./perl t/io/eintr_print.t ) && echo
> > ALL_FINE
> > > > > > (i.e. 100 concurrent runs) and it was fine. > > > > > > On Sat Aug 10 17:02:36 2013, tonyc wrote:
> > > > On Sat Aug 10 15:51:13 2013, tonyc wrote:
> > > > > This test has blocked one of my darwin smokers, but doesn't
> appear to
> > > > > block every time:
> > > > > > > > It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2. > > > > > > > > Tony
> > > > > >
> > > >
> >
From ea8aff5fe307d300ce2a72120f941102fe0dd016 Mon Sep 17 00:00:00 2001 From: Victor <victor@vsespb.ru> Date: Mon, 12 Aug 2013 12:49:58 +0400 Subject: [PATCH 25/25] Fixing eintr_print.t intermittent hang 1. Disable test for PERLIO=stdio 2. Remove binmode - it turns out it's useless 3. Copy OS blacklist from eintr.t ( RT #85842, RT #84688) 4. Add additional delay before child exit, just in case. --- t/io/eintr_print.t | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/t/io/eintr_print.t b/t/io/eintr_print.t index 56ab5b4..1e378fa 100644 --- a/t/io/eintr_print.t +++ b/t/io/eintr_print.t @@ -27,6 +27,16 @@ skip_all("usleep() not implemented on this platform") unless Time::HiRes::d_usleep(); skip_all("pipe not implemented on this platform") unless eval { pipe my $in, my $out; 1; }; +skip_all("not supposed to work with stdio") + if (defined $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/ ); + +# copy OS blacklist from eintr.t ( related to perl #85842 and #84688 ) +my ($osmajmin) = $Config{osvers} =~ /^(\d+\.\d+)/; + +skip_all('various portability issues') + if ( $^O =~ /freebsd/ || $^O eq 'midnightbsd' || + ($^O eq 'solaris' && $Config{osvers} eq '2.8') || + ($^O eq 'darwin' && $osmajmin < 9) ); my $sample = 'abxhrtf6'; my $full_sample = 'abxhrtf6' x (8192-7); @@ -47,7 +57,6 @@ if (my $pid = fork()) { my $child_exited = 0; $in->autoflush(1); $in->blocking(1); - binmode $in, ":perlio"; Time::HiRes::usleep $big_delay; @@ -71,7 +80,6 @@ if (my $pid = fork()) { local $SIG{ALRM} = sub { print "# ALRM $$\n" }; $out->autoflush(1); $out->blocking(1); - binmode $out, ":perlio"; for (1..10) { # on some iteration print() will block Time::HiRes::ualarm($small_delay); # and when it block we'll get SIGALRM @@ -79,7 +87,7 @@ if (my $pid = fork()) { die "print failed [ $! ]" unless print($out $full_sample); Time::HiRes::ualarm(0); } - + Time::HiRes::usleep(500_000); exit(0); } -- 1.7.0.4
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 335b
On Mon Aug 12 02:01:50 2013, vsespb wrote: Show quoted text
> attaching fixes to eintr_print.t
Applied as b893ae5e183df130e3225a0aaf8ac963a6f6d1ff (the original patch), 878bfcdfc7542cbd6624b88ea6e16bd3ac01b3cd (the skips) and a merge commit 18603efee1e80bda2f6107c9569d056cb1071d4b to bring them all and in the darkness... urr, to combine them. Tony


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org