Actions
Bug #21649
openRactors can access non-shareable object through singleton classes
Bug #21649:
Ractors can access non-shareable object through singleton classes
Description
If we send a non-shareable object into a Ractor, it needs to be copied.
❯ ruby -W0 -e 'Ractor.new(p(Object.new)) { |o| p(o) }.join'
#<Object:0x00000001240f8cf8>
#<Object:0x00000001240f8870>
However we're able to instead smuggle it through a singleton class to unsafely get a mutable reference to the same object in both Ractors.
❯ ruby -W0 -e 'Ractor.new(p(Object.new).singleton_class) { |o| p(o.attached_object) }.join'
#<Object:0x0000000120768c40>
#<Object:0x0000000120768c40>
I think we should probably make singleton classes copy the shareability of their attached object.
No data to display
Actions