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

die/CATCH inside a start-block with a channel heisenbugs #5718

Open
p6rt opened this issue Oct 2, 2016 · 6 comments
Open

die/CATCH inside a start-block with a channel heisenbugs #5718

p6rt opened this issue Oct 2, 2016 · 6 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Oct 2, 2016

Migrated from rt.perl.org#129787 (status was 'open')

Searchable as RT129787$

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 2, 2016

From @gfldex

sub f(){
  my $c = Channel.new;

  start {
  for 1..* {
  CATCH { default { note .Str } }

  $c.send($_);
  die 'bad';
  }
  }

  $c.list
}

.say for f;

# sometimes it works
# sometimes it counts to 20 and outputs​:
# Command terminated
# sometimes it outputs some numbers and 'bad's end then some
# unicode-garbage
# sometimes it outputs a few 100s 'bad' and then stalls with one thread at
# 100% CPU
# heisenbug rate is about 1/3
#
# also it seams to eat up plenty of RAM while it's running without the
# die/CATCH

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 2, 2016

From @MasterDuke17

On Sun Oct 02 12​:52​:45 2016, gfldex wrote​:

sub f(){
my $c = Channel.new;

 start \{
     for 1\.\.\* \{
         CATCH \{ default \{ note \.Str \} \}

         $c\.send\($\_\);
         die 'bad';
     \}
 \}

 $c\.list

}

.say for f;

# sometimes it works
# sometimes it counts to 20 and outputs​:
# Command terminated
# sometimes it outputs some numbers and 'bad's end then some
# unicode-garbage
# sometimes it outputs a few 100s 'bad' and then stalls with one thread at
# 100% CPU
# heisenbug rate is about 1/3
#
# also it seams to eat up plenty of RAM while it's running without the
# die/CATCH

valgrind output when I ran it​:
https://gist.github.com/MasterDuke17/e98b6e661aef2d467232c47b3a443b19

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 2, 2016

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

@p6rt
Copy link
Author

@p6rt p6rt commented Nov 2, 2016

From @jnthn

On Sun Oct 02 12​:52​:45 2016, gfldex wrote​:

sub f(){
my $c = Channel.new;

 start \{
     for 1\.\.\* \{
         CATCH \{ default \{ note \.Str \} \}

         $c\.send\($\_\);
         die 'bad';
     \}
 \}

 $c\.list

}

.say for f;

# sometimes it works
# sometimes it counts to 20 and outputs​:
# Command terminated
# sometimes it outputs some numbers and 'bad's end then some
# unicode-garbage
# sometimes it outputs a few 100s 'bad' and then stalls with one thread at
# 100% CPU
# heisenbug rate is about 1/3
#
# also it seams to eat up plenty of RAM while it's running without the
# die/CATCH

This one is yet another case of the long-standing issues with use of handles across threads. The channel golfs away; you can get this bug with just​:

start { for ^100 { note "hi" } }; for ^100 { say "oops" }

/jnthn

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 15, 2017

From @zoffixznet

On Wed, 02 Nov 2016 07​:13​:26 -0700, jnthn@​jnthn.net wrote​:

On Sun Oct 02 12​:52​:45 2016, gfldex wrote​:

sub f(){
my $c = Channel.new;

start {
for 1..* {
CATCH { default { note .Str } }

$c.send($_);
die 'bad';
}
}

$c.list
}

.say for f;

# sometimes it works
# sometimes it counts to 20 and outputs​:
# Command terminated
# sometimes it outputs some numbers and 'bad's end then some
# unicode-garbage
# sometimes it outputs a few 100s 'bad' and then stalls with one
thread at
# 100% CPU
# heisenbug rate is about 1/3
#
# also it seams to eat up plenty of RAM while it's running without
the
# die/CATCH

This one is yet another case of the long-standing issues with use of
handles across threads. The channel golfs away; you can get this bug
with just​:

start { for ^100 { note "hi" } }; for ^100 { say "oops" }

/jnthn

This is now fixed, but have no idea how to test it… On 2016.10, I can only repro this bug with STDERR/STDOUT set to a TTY terminal.

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 4, 2018

From @AlexDaniel

FWIW, this bug is somewhat similar in feel​: rakudo/rakudo#1202

On 2017-10-15 03​:14​:02, cpan@​zoffix.com wrote​:

On Wed, 02 Nov 2016 07​:13​:26 -0700, jnthn@​jnthn.net wrote​:

On Sun Oct 02 12​:52​:45 2016, gfldex wrote​:

sub f(){
my $c = Channel.new;

start {
for 1..* {
CATCH { default { note .Str } }

$c.send($_);
die 'bad';
}
}

$c.list
}

.say for f;

# sometimes it works
# sometimes it counts to 20 and outputs​:
# Command terminated
# sometimes it outputs some numbers and 'bad's end then some
# unicode-garbage
# sometimes it outputs a few 100s 'bad' and then stalls with one
thread at
# 100% CPU
# heisenbug rate is about 1/3
#
# also it seams to eat up plenty of RAM while it's running without
the
# die/CATCH

This one is yet another case of the long-standing issues with use of
handles across threads. The channel golfs away; you can get this bug
with just​:

start { for ^100 { note "hi" } }; for ^100 { say "oops" }

/jnthn

This is now fixed, but have no idea how to test it… On 2016.10, I can
only repro this bug with STDERR/STDOUT set to a TTY terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant