On Wed, 06 Sep 2017 13:46:15 -0700, [email protected] wrote:
> This short program hangs indefinitely on my system (after making
> progress.) Tuning the number of threads and number of iterations can
> change how reliably it hangs (down to 'never' when the number of
> threads is < 3, for me.)
>
> ```
> #!/usr/bin/env perl6
>
> use v6.c;
>
> await (^6).map: -> $t {
> start {
> for (^500) -> $i {
> my $current = %( 1 => %( 2 => %( 3 => %() ) ) );
> my $index = 1;
> while $current{$index}:exists {
> say "$t $i $index";
> $current = $current{$index};
> ++$index;
> }
> }
> }
> }
> ```
>
> ... this is a distilled version of some tree-walking code that's
> misbehaving for me IRL. It's possible that I'm doing something naughty
> here, but I don't see how. Am I missing something? (I can eliminate
> the deadlock by Lock.protect-ing the inner while loop, FWIW... but I
> don't see why that should be necessary.)
>
> More information:
>
> ```
> $ perl6 --version
> This is Rakudo version 2017.07 built on MoarVM version 2017.07
> implementing Perl 6.c.
> ```
This can be golfed to:
my $foo = 0; for ^50000 { start { say $foo++ } };
Rakudo 2017.03 or earlier does not have this issue. You can also remove the
`say` from the examples and they do not have this issue.
gdb output:
https://gist.github.com/ugexe/cf2350b4bd5ed58e3a8f6e049df1432f
irc discussion:
https://irclog.perlgeek.de/perl6-dev/2017-09-06#i_15127640