* [ruby-core:104519] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects
@ 2021-07-06 14:28 i
2021-07-07 18:35 ` [ruby-core:104537] " i
2021-10-16 4:56 ` [ruby-core:105651] " nagachika (Tomoyuki Chikanaga)
0 siblings, 2 replies; 3+ messages in thread
From: i @ 2021-07-06 14:28 UTC (permalink / raw)
To: ruby-core
Issue #18023 has been reported by slowpilot (Ivan Razuvaev).
----------------------------------------
Bug #18023: Ractor#make_shareable changes the values of closured shareable objects
https://bugs.ruby-lang.org/issues/18023
* Author: slowpilot (Ivan Razuvaev)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.0, 3.0.1
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Hi. I encountered strange behaviour or shareable procs when every even closured shareable variable becomes the FalseClass instance.
``` ruby
[usr@srvr ~]$ irb
3.0.1 :001 > v1, v2, v3, v4 = :a, :b, :c, :d
=> [:a, :b, :c, :d]
3.0.1 :002 > p = Proc.new { p v1, v2, v3, v4 }
=> #<Proc:0x000000000248ed18 (irb):2>
3.0.1 :003 > p.()
:a
:b
:c
:d
=> [:a, :b, :c, :d]
3.0.1 :004 > Ractor.make_shareable(p).()
:a
false
:c
false
=> [:a, false, :c, false]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:104537] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects
2021-07-06 14:28 [ruby-core:104519] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects i
@ 2021-07-07 18:35 ` i
2021-10-16 4:56 ` [ruby-core:105651] " nagachika (Tomoyuki Chikanaga)
1 sibling, 0 replies; 3+ messages in thread
From: i @ 2021-07-07 18:35 UTC (permalink / raw)
To: ruby-core
Issue #18023 has been updated by slowpilot (Ivan Razuvaev).
slowpilot (Ivan Razuvaev) wrote:
> Hi. I encountered strange behaviour or shareable procs when every even closured shareable variable becomes the FalseClass instance.
>
> ``` ruby
> [usr@srvr ~]$ irb
> 3.0.1 :001 > v1, v2, v3, v4 = :a, :b, :c, :d
> => [:a, :b, :c, :d]
> 3.0.1 :002 > p = Proc.new { p v1, v2, v3, v4 }
> => #<Proc:0x000000000248ed18 (irb):2>
> 3.0.1 :003 > p.()
> :a
> :b
> :c
> :d
> => [:a, :b, :c, :d]
> 3.0.1 :004 > Ractor.make_shareable(p).()
> :a
> false
> :c
> false
> => [:a, false, :c, false]
> ```
This is stopping from using dynamically defined methods from ractors. E.g. in Ruby [libtorch](https://github.com/orlando-labs/torch.rb/blob/2c8c1c89ded3ac924a19020d6c747582d1c828cc/lib/torch.rb#L256). So after calling rb_ext_ractor_safe in extension, I am trying to do something like:
```ruby
cls.define_singleton_method('new', Ractor.make_shareable(Proc.new { ... })
```
That leads to every second closure assignment to false.
----------------------------------------
Bug #18023: Ractor#make_shareable changes the values of closured shareable objects
https://bugs.ruby-lang.org/issues/18023#change-92812
* Author: slowpilot (Ivan Razuvaev)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.0, 3.0.1
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Hi. I encountered strange behaviour or shareable procs when every even closured shareable variable becomes the FalseClass instance.
``` ruby
[usr@srvr ~]$ irb
3.0.1 :001 > v1, v2, v3, v4 = :a, :b, :c, :d
=> [:a, :b, :c, :d]
3.0.1 :002 > p = Proc.new { p v1, v2, v3, v4 }
=> #<Proc:0x000000000248ed18 (irb):2>
3.0.1 :003 > p.()
:a
:b
:c
:d
=> [:a, :b, :c, :d]
3.0.1 :004 > Ractor.make_shareable(p).()
:a
false
:c
false
=> [:a, false, :c, false]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:105651] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects
2021-07-06 14:28 [ruby-core:104519] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects i
2021-07-07 18:35 ` [ruby-core:104537] " i
@ 2021-10-16 4:56 ` nagachika (Tomoyuki Chikanaga)
1 sibling, 0 replies; 3+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2021-10-16 4:56 UTC (permalink / raw)
To: ruby-core
Issue #18023 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED to 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE
ruby_3_0 5427b08381fb0d644ec69d5aa94234f90a4fbed1 merged revision(s) 76228191474c76810043b294a74bbb2f1808b3d9.
----------------------------------------
Bug #18023: Ractor#make_shareable changes the values of closured shareable objects
https://bugs.ruby-lang.org/issues/18023#change-94153
* Author: slowpilot (Ivan Razuvaev)
* Status: Closed
* Priority: Normal
* ruby -v: 3.0.0, 3.0.1
* Backport: 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE
----------------------------------------
Hi. I encountered strange behaviour or shareable procs when every even closured shareable variable becomes the FalseClass instance.
``` ruby
[usr@srvr ~]$ irb
3.0.1 :001 > v1, v2, v3, v4 = :a, :b, :c, :d
=> [:a, :b, :c, :d]
3.0.1 :002 > p = Proc.new { p v1, v2, v3, v4 }
=> #<Proc:0x000000000248ed18 (irb):2>
3.0.1 :003 > p.()
:a
:b
:c
:d
=> [:a, :b, :c, :d]
3.0.1 :004 > Ractor.make_shareable(p).()
:a
false
:c
false
=> [:a, false, :c, false]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-16 4:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:28 [ruby-core:104519] [Ruby master Bug#18023] Ractor#make_shareable changes the values of closured shareable objects i
2021-07-07 18:35 ` [ruby-core:104537] " i
2021-10-16 4:56 ` [ruby-core:105651] " nagachika (Tomoyuki Chikanaga)
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).