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

Curly-brace string interpolation is not thread safe #6477

Closed
p6rt opened this issue Aug 29, 2017 · 5 comments
Closed

Curly-brace string interpolation is not thread safe #6477

p6rt opened this issue Aug 29, 2017 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 29, 2017

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

Searchable as RT131985$

@p6rt
Copy link
Author

p6rt commented Aug 29, 2017

From j.david.lowe@apple.com

This short program behaves strangely on my system​:

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

use v6.c;

await((1 .. 5).map​: -> $tid {
  start {
  for (1 .. 100) -> $index {
  my $s-tid = "{$tid}";
  my $s-index = "{$index}";

  say "thread $tid != stringified $s-tid" unless $tid ~~ $s-tid;
  say "index $index != stringified $s-index" unless $index ~~ $s-index;
  }
  }
});
```

... producing output like​:

```
$ ./bug
thread 2 != stringified 1
index 54 != stringified 11
thread 5 != stringified 4
thread 3 != stringified 2
index 61 != stringified 39
index 42 != stringified 16
thread 5 != stringified 2
thread 2 != stringified 1
index 66 != stringified 53
index 57 != stringified 79
thread 1 != stringified 3
index 59 != stringified 70
thread 4 != stringified 1
index 36 != stringified 71
index 39 != stringified 76
index 41 != stringified 97
thread 2 != stringified 5

$ ./bug
thread 2 != stringified 5
index 26 != stringified 35
index 47 != stringified 58
thread 4 != stringified 2
index 19 != stringified 33
```

It's hard to imagine that this could be correct.

More information​:

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

@p6rt
Copy link
Author

p6rt commented Aug 29, 2017

From @smls

Possibly related to​:

https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131871

@p6rt
Copy link
Author

p6rt commented Aug 29, 2017

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

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

From @jnthn

On Mon, 28 Aug 2017 17​:59​:39 -0700, j.david.lowe@​apple.com wrote​:

This short program behaves strangely on my system​:

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

use v6.c;

await((1 .. 5).map​: -> $tid {
start {
for (1 .. 100) -> $index {
my $s-tid = "{$tid}";
my $s-index = "{$index}";

say "thread $tid != stringified $s-tid" unless $tid ~~ $s-tid;
say "index $index != stringified $s-index" unless $index ~~ $s-index;
}
}
});
```

... producing output like​:

```
$ ./bug
thread 2 != stringified 1
index 54 != stringified 11
thread 5 != stringified 4
thread 3 != stringified 2
index 61 != stringified 39
index 42 != stringified 16
thread 5 != stringified 2
thread 2 != stringified 1
index 66 != stringified 53
index 57 != stringified 79
thread 1 != stringified 3
index 59 != stringified 70
thread 4 != stringified 1
index 36 != stringified 71
index 39 != stringified 76
index 41 != stringified 97
thread 2 != stringified 5

$ ./bug
thread 2 != stringified 5
index 26 != stringified 35
index 47 != stringified 58
thread 4 != stringified 2
index 19 != stringified 33
```

It's hard to imagine that this could be correct.

More information​:

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

Fixed, and test added to S17-promise/start.t.

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

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

@p6rt p6rt closed this as completed Sep 6, 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