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


This short program behaves dies on my system, apparently because the mixed-in 
attribute is somehow "leaking" between the two threads (???):

```
#!/usr/bin/env perl6

await((^2).map: {
   start {
      for (^10) -> $i {
         my $x = Str.new but role { has $.test = $i };
         die "$i != " ~ $x.test unless $x.test == $i;
      }
   }
});
```

produces output like:

```
$ ./bug
Tried to get the result of a broken Promise
  in block <unit> at ./bug line 3

Original exception:
    1 != 2
      in block  at ./bug line 7

$ ./bug
Tried to get the result of a broken Promise
  in block <unit> at ./bug line 3

Original exception:
    3 != 4
      in block  at ./bug line 7
```

It's possible that what I'm doing in this code isn't *intended* to be 
thread-safe, but if that's the case, I don't understand why (e.g. looking at 
the code, the two threads appear to be completely isolated.)

More information:

```
$ perl6 --version
This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.
```

Reply via email to