ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:116085] [Ruby master Bug#20165] Ractors moving a Struct breaks beyond the first 3 fields
@ 2024-01-08 21:02 codekitchen (Brian Palmer) via ruby-core
  2024-01-10 19:26 ` [ruby-core:116158] " luke-gru (Luke Gruber) via ruby-core
  0 siblings, 1 reply; 2+ messages in thread
From: codekitchen (Brian Palmer) via ruby-core @ 2024-01-08 21:02 UTC (permalink / raw
  To: ruby-core; +Cc: codekitchen (Brian Palmer)

Issue #20165 has been reported by codekitchen (Brian Palmer).

----------------------------------------
Bug #20165: Ractors moving a Struct breaks beyond the first 3 fields
https://bugs.ruby-lang.org/issues/20165

* Author: codekitchen (Brian Palmer)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Experimenting with Ractors on ruby 3.3.0, and I'm seeing a bug where if you move a struct between ractors, all but the first 3 fields are set to nil.

``` ruby
Foo = Struct.new(:a,:b,:c,:d,:e,:f)

r = Ractor.new {
  foo = Foo[0,0,0,0,0,0]
  p foo
  Ractor.yield(foo, move: true)
}
p r.take

```


```
❯ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
❯ ruby rbug.rb       
rbug.rb:3: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
#<struct Foo a=0, b=0, c=0, d=0, e=0, f=0>
#<struct Foo a=0, b=0, c=0, d=nil, e=nil, f=nil>
```

This seems specific to moving, if I set `move: false` the struct makes it across OK.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:116158] [Ruby master Bug#20165] Ractors moving a Struct breaks beyond the first 3 fields
  2024-01-08 21:02 [ruby-core:116085] [Ruby master Bug#20165] Ractors moving a Struct breaks beyond the first 3 fields codekitchen (Brian Palmer) via ruby-core
@ 2024-01-10 19:26 ` luke-gru (Luke Gruber) via ruby-core
  0 siblings, 0 replies; 2+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-01-10 19:26 UTC (permalink / raw
  To: ruby-core; +Cc: luke-gru (Luke Gruber)

Issue #20165 has been updated by luke-gru (Luke Gruber).


I sent a fix for this here https://github.com/ruby/ruby/pull/9475. There were other issues with moving as well, it wasn't just for structs.

----------------------------------------
Bug #20165: Ractors moving a Struct breaks beyond the first 3 fields
https://bugs.ruby-lang.org/issues/20165#change-106163

* Author: codekitchen (Brian Palmer)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Experimenting with Ractors on ruby 3.3.0, and I'm seeing a bug where if you move a struct between ractors, all but the first 3 fields are set to nil.

``` ruby
Foo = Struct.new(:a,:b,:c,:d,:e,:f)

r = Ractor.new {
  foo = Foo[0,0,0,0,0,0]
  p foo
  Ractor.yield(foo, move: true)
}
p r.take

```


```
❯ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
❯ ruby rbug.rb       
rbug.rb:3: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
#<struct Foo a=0, b=0, c=0, d=0, e=0, f=0>
#<struct Foo a=0, b=0, c=0, d=nil, e=nil, f=nil>
```

This seems specific to moving, if I set `move: false` the struct makes it across OK.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-10 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08 21:02 [ruby-core:116085] [Ruby master Bug#20165] Ractors moving a Struct breaks beyond the first 3 fields codekitchen (Brian Palmer) via ruby-core
2024-01-10 19:26 ` [ruby-core:116158] " luke-gru (Luke Gruber) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).