Skip Menu |
Report information
Id: 132042
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: j.david.lowe [at] apple.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Date: Wed, 06 Sep 2017 13:45:45 -0700
From: "J . David Lowe" <j.david.lowe [...] apple.com>
Subject: [BUG] rakudo hangs while concurrently walking trees
Download (untitled) / with headers
text/plain 1017b
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. ```
To: "J . David Lowe (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Wed, 6 Sep 2017 22:57:05 +0200
Subject: Re: [perl #132042] [BUG] rakudo hangs while concurrently walking trees
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 1.5k
Show quoted text
> On 6 Sep 2017, at 22:46, J . David Lowe (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by J . David Lowe > # Please include the string: [perl #132042] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=132042 > > > > 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. > ```
Could you try if this is still the case in 2017.08? And possibly the latest development version? Also, could you try and see if “use 6.d.PREVIEW” makes a difference?
Date: Wed, 06 Sep 2017 14:21:20 -0700
To: perl6-bugs-followup [...] perl.org
From: "J . David Lowe" <j.david.lowe [...] apple.com>
Subject: Re: [perl #132042] [BUG] rakudo hangs while concurrently walking trees
Download (untitled) / with headers
text/plain 1.9k
Show quoted text
> On Sep 6, 2017, at 1:57 PM, Elizabeth Mattijsen via RT <perl6-bugs-followup@perl.org> wrote: > >
>> On 6 Sep 2017, at 22:46, J . David Lowe (via RT) <perl6-bugs-followup@perl.org> wrote: >> >> # New Ticket Created by J . David Lowe >> # Please include the string: [perl #132042] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=132042 > >> >> >> 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. >> ```
> > Could you try if this is still the case in 2017.08? And possibly the latest development version? > > Also, could you try and see if “use 6.d.PREVIEW” makes a difference?
'use v6.d.PREVIEW' did not fix it. Switching to: ``` voot:p6bug dlowe$ perl6 --version This is Rakudo version 2017.08 built on MoarVM version 2017.08.1 implementing Perl 6.c. ``` ... also did not fix it (with either 'use v6.c' or 'use v6.d.PREVIEW').
Download (untitled) / with headers
text/plain 1.4k
On Wed, 06 Sep 2017 13:46:15 -0700, j.david.lowe@apple.com wrote: Show quoted text
> 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
Download (untitled) / with headers
text/plain 141b
Resolved with https://github.com/MoarVM/MoarVM/commit/32322f393365c235807d69f54370caa64c3a31fb but not sure how to write a test for deadlocks
Download (untitled) / with headers
text/plain 397b
Even simpler test-case: for ^10000 { start say $_ } For me, this almost always hangs (after printing a few dozen or few hundred lines), with the MoarVM version currently used by Rakudo nom: MoarVM version 2017.08.1-128-gde6dced But *no longer* hangs with MoarVM master (which has the fix by ugexe++): MoarVM version 2017.08.1-148-g1059eed1 \o/ Marking this ticket as TESTNEEDED.


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