Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print returning EINTR in 5.14 #13142

Closed
p5pRT opened this issue Jul 31, 2013 · 19 comments

Comments

@p5pRT
Copy link

commented Jul 31, 2013

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

Searchable as RT119097$

@p5pRT

This comment has been minimized.

Copy link
Author

commented Jul 31, 2013

From victor@vsespb.ru

Test case​:

#!/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.

@p5pRT

This comment has been minimized.

Copy link
Author

commented Jul 31, 2013

From @iabyn

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 be48bbe
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.

@p5pRT

This comment has been minimized.

Copy link
Author

commented Jul 31, 2013

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Jul 31, 2013

From victor@vsespb.ru

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 be48bbe does not contain test.

On Wed Jul 31 15​:40​:17 2013, davem wrote​:

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 be48bbe
Author​: Chip <chip@​pobox.com>
Date​: Mon Sep 19 23​:51​:49 2011 -0700

add a couple missing LEAVEs in perlio\_async\_run\(\)
@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 1, 2013

From @cpansprout

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 be48bbe does not contain test.

If you could, that would be much appreciated.

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 2, 2013

From victor@vsespb.ru

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 be48bbe does not contain test.

If you could, that would be much appreciated.

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 2, 2013

From victor@vsespb.ru

0001-Print-and-EINTR-test.patch
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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 8, 2013

From @nwc10

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 be48bbe 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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 10, 2013

From @tonycoz

On Thu Aug 08 01​:58​:52 2013, nicholas wrote​:

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 be48bbe 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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From @tonycoz

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From victor@vsespb.ru

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
block every time​:

It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2.

Tony

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From victor@vsespb.ru

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
block every time​:

It also blocked on Linux amd64, Solaris 11, NetBSD 5.1.2.

Tony

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From victor@vsespb.ru

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-archive.perl.org/perl5/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-archive.perl.org/perl5/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
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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From @Leont

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 11, 2013

From victor@vsespb.ru

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​:

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 12, 2013

From victor@vsespb.ru

attaching fixes to eintr_print.t

On Sun Aug 11 05​:18​:43 2013, vsespb 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";

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-archive.perl.org/perl5/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-archive.perl.org/perl5/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
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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Aug 12, 2013

From victor@vsespb.ru

0025-Fixing-eintr_print.t-intermittent-hang.patch
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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Sep 17, 2013

From @tonycoz

On Mon Aug 12 02​:01​:50 2013, vsespb wrote​:

attaching fixes to eintr_print.t

Applied as b893ae5 (the original
patch), 878bfcd (the skips) and a merge
commit 18603ef to bring them all and in
the darkness... urr, to combine them.

Tony

@p5pRT

This comment has been minimized.

Copy link
Author

commented Sep 17, 2013

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

@p5pRT p5pRT closed this Sep 17, 2013
@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.