# New Ticket Created by  Elizabeth Mattijsen 
# Please include the string:  [perl #127968]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127968 >


[2016-04-22T16:08:20+0100] <marcusramberg> Listening to Damian talk about 
concurrency in Oslo, and I tried one of his examples, but it seems to crash 
perl6 when you try to run it for some iterations - 
https://gist.github.com/marcusramberg/f789306f4f580c6cf1270ca12a333391
[2016-04-22T16:08:30+0100] <marcusramberg> gives me [1]    33874 abort      
perl6 channel.p6
[2016-04-22T16:11:44+0100] <RabidGravy> marcusramberg, so it does
[2016-04-22T16:12:23+0100] <lizmat> marcusramberg: crash confirmed  :-(
[2016-04-22T16:12:34+0100] <marcusramberg> :-/
[2016-04-22T16:13:29+0100] <lizmat> marcusramberg: the good news is that it 
fails consistently after a fixed number of iterations
[2016-04-22T16:13:31+0100] <perlpilot> marcusramberg: Did Damian actually run 
it ?
[2016-04-22T16:13:41+0100] <marcusramberg> perlpilot: only once
[2016-04-22T16:13:50+0100] <RabidGravy> lizmat, marcusramberg it appears to be 
associated with garbage collection looking at the backtrace
[2016-04-22T16:13:55+0100] <lizmat> marcusramberg: and that number actually 
differs with different settings of MVM_SPESH_DISABLE and --optimize
[2016-04-22T16:13:59+0100] <perlpilot> marcusramberg: do you happen to know 
what rakudo version he was using?
[2016-04-22T16:14:53+0100] <lizmat> if I add an "nqp::force_gc" to the 
sleep_sort sub, it doesn't fail
[2016-04-22T16:15:11+0100] <marcusramberg> perlpilot: no. he's still talking :)
[2016-04-22T16:15:29+0100] <lizmat> RabidGravy: so indeed GC related
[2016-04-22T16:15:41+0100] <perlpilot> marcusramberg: well ask him about it!  
See if he admits to shenanigans  ;)
[2016-04-22T16:18:26+0100] <lizmat> marcusramberg: care to submit a rakudobug ?
[2016-04-22T16:18:57+0100] <marcusramberg> lizmat: I can try
[2016-04-22T16:19:18+0100] <lizmat> copy this discussion to an email and send 
it to rakudo...@perl.org


The code in question:
======================================================
sub sleep_sort (*@list where .all >= 0) {

  my $channel = Channel.new;

  await @list.map: -> $delay {
    Promise.start({
      sleep $delay / 1000;
      $channel.send($delay);
    });

  };

  $channel.close;

  return $channel.list;
}

say sleep_sort(3,2,1,5,4) for (1 ... 10000);
======================================================

Reply via email to