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

hyper is very broken, *sometimes* it returns nothing #5111

Closed
p6rt opened this issue Feb 2, 2016 · 7 comments
Closed

hyper is very broken, *sometimes* it returns nothing #5111

p6rt opened this issue Feb 2, 2016 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 2, 2016

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

Searchable as RT127452$

@p6rt
Copy link
Author

p6rt commented Feb 2, 2016

From @AlexDaniel

Let's try running the same code twice​:

<AlexDaniel> m​: my @​x = ^10; my @​y = @​x.hyper(​:3batch, :5degree).map​: {
sleep rand / 100000; $_ + 1 }; say @​y
<camelia> rakudo-moar a5fe34​: OUTPUT«[]â�¤Â»
<AlexDaniel> m​: my @​x = ^10; my @​y = @​x.hyper(​:3batch, :5degree).map​: {
sleep rand / 100000; $_ + 1 }; say @​y
<camelia> rakudo-moar a5fe34​: OUTPUT«[1 2 3 4 5 6 7 8 9 10]â�¤Â»

The thing is that sometimes ï½¢hyperï½£ decides to return an empty list. This
is a real problem because it basically renders it useless (too unreliable).

If you have problems reproducing it, try changing ï½¢/ 100000ï½£ to something
else. This delay is not really relevant but it seems like it affects the
chances to get one result or another.

Here's also a golfed down version​:

Code​:
dd @​(^10 .hyper(​:1batch).map​: { sleep rand; $_ })

Result​:
()
OR
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

According to the execution time ï½¢hyperï½£ does not even bother to compute the
result in these problematic cases (it just returns an empty list without
trying to process the data). That being said, there is a chance that it
fails half way through, see next example.

Another interesting issue (probably the same one)​:

Code​:
.say for (^10).hyper(​:1batch).map​: { sleep rand; $_ }

Result​:
1
OR
2
OR
3
OR
0
3
2
1
5
8
7
4
6
9
OR etc.

So not only it is out of order (#​127099), but it is also extremely broken.

It looks like there is no such problem with ï½¢raceï½£.

IRC log (nothing useful there though)​:
http://irclog.perlgeek.de/perl6/2016-02-02#i_11975794

@p6rt
Copy link
Author

p6rt commented Aug 18, 2016

From liukan@360.cn

the following code produces () on random occasions.

while 1 {
my @​a = 1, 3, 2, 9, 0, |( 1 .. 100 );
my $a = @​a.hyper.map​: * + 1;
$a.list.say;
}

(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
()
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)
()
(2 4 3 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...)

liukan@​candor​:~/Code$ perl6 -v
This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
implementing Perl 6.c.
liukan@​candor​:~/Code$ uname -a
Linux candor 4.4.0-34-generic #​53-Ubuntu SMP Wed Jul 27 16​:06​:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

- kan

@p6rt
Copy link
Author

p6rt commented Sep 8, 2016

From @smls

Can still confirm on [Rakudo version 2016.08.1-116-gf648d3b built on MoarVM version 2016.08-32-ge52414d].

Seems related to tickets 126597 and 128084, except that those are about cases where hyper *reliably* returns an empty sequence instead of the correct result.

@p6rt
Copy link
Author

p6rt commented Sep 8, 2016

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

@p6rt
Copy link
Author

p6rt commented Jan 17, 2017

From darkfeathers9@gmail.com

perl6 --version​:
This is Rakudo version 2016.12 built on MoarVM version 2016.12

OS​: Arch Linux using GCC compiler and MoarVM

Using .hyper on an array sometimes returns a result and most of the
times it does not. Additionally using .hyper may cause the entire
process to sleep and no output returns.

Code​:

use experimental :pack;

my $file = slurp("pic.png", :bin);
my $start = 8;
my $end = 11;
my $len = 0;
my $header = "";

my $data = "";
while $end <= $file.bytes {
  $len = :16(Blob.new($file[$start..$end]).unpack("H*")) ;
  $header = Blob.new($file[$start+4..$end+4]).unpack("H*");

  #!!!!!!!!!!!!!!!!!Problem is here!!!!!!!!!!!!!!!!!
  $data = $file[$start+8 ..$start+8+$len].hyper.map({$_
.fmt('%02x')}).list;

  say $data;
  $start = $start + $len + 12 ;
  $end = $start + 3;
}

expected output (Omitting .hyper and using only first 3 lines of
output)​:
(00 00 01 85 00 00 02 6c 08 06 00 00 00 12)
(08 08 08 08 7c)
(53 6f 66 74 77 61 72 65 00 67 6e 6f 6d 65 2d 73 63 72 65 65 6e 73 68
6f 74 ef)

actual output​:
()
()
()
*process sleeps here*

@p6rt
Copy link
Author

p6rt commented Oct 18, 2017

From @jnthn

On Mon, 01 Feb 2016 21​:59​:33 -0800, alex.jakimenko@​gmail.com wrote​:

Let's try running the same code twice​:

<AlexDaniel> m​: my @​x = ^10; my @​y = @​x.hyper(​:3batch, :5degree).map​: {
sleep rand / 100000; $_ + 1 }; say @​y
<camelia> rakudo-moar a5fe34​: OUTPUT«[]â�¤Â»
<AlexDaniel> m​: my @​x = ^10; my @​y = @​x.hyper(​:3batch, :5degree).map​: {
sleep rand / 100000; $_ + 1 }; say @​y
<camelia> rakudo-moar a5fe34​: OUTPUT«[1 2 3 4 5 6 7 8 9 10]â�¤Â»

The thing is that sometimes ï½¢hyperï½£ decides to return an empty list. This
is a real problem because it basically renders it useless (too unreliable).

If you have problems reproducing it, try changing ï½¢/ 100000ï½£ to something
else. This delay is not really relevant but it seems like it affects the
chances to get one result or another.

Here's also a golfed down version​:

Code​:
dd @​(^10 .hyper(​:1batch).map​: { sleep rand; $_ })

Result​:
()
OR
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

According to the execution time ï½¢hyperï½£ does not even bother to compute the
result in these problematic cases (it just returns an empty list without
trying to process the data). That being said, there is a chance that it
fails half way through, see next example.

Another interesting issue (probably the same one)​:

Code​:
.say for (^10).hyper(​:1batch).map​: { sleep rand; $_ }

Result​:
1
OR
2
OR
3
OR
0
3
2
1
5
8
7
4
6
9
OR etc.

So not only it is out of order (#​127099), but it is also extremely broken.

It looks like there is no such problem with ï½¢raceï½£.

IRC log (nothing useful there though)​:
http://irclog.perlgeek.de/perl6/2016-02-02#i_11975794

Fixed in new hyper/race implementation; tests in S07-hyperrace/hyper.t and S07-hyperrace/race.t (for original post and other examples that I found in the discussion of this ticket).

@p6rt
Copy link
Author

p6rt commented Oct 18, 2017

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

@p6rt p6rt closed this as completed Oct 18, 2017
@p6rt p6rt added the conc label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant