Actions
Bug #19372
openProc objects are not traversed for shareable check during Ractor.make_shareable(prok)
Description
class Proc
attr_accessor :obj1
def initialize
@obj1 = Object.new
end
end
p = true.instance_eval { Proc.new { puts "hi" } }
Ractor.make_shareable(p)
p "Obj1 frozen?", Ractor.shareable?(p.obj1)
P = p
r = Ractor.new do
pp = P
p pp.obj1 # gives error in debug builds (rb_ractor_confirm_belonging rb_bug() call)
end
Updated by luke-gru (Luke Gruber) almost 2 years ago
A separate but related issue is that the proc objects are not frozen too, so their ivars can be (re)assigned. I don't know how big an issue that is because
other ractors cannot read/write the ivars but IMO the proc should be frozen.
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
Maybe https://github.com/nobu/ruby/tree/ractor-unshareable-data fixes it?
Updated by luke-gru (Luke Gruber) almost 2 years ago
No I don't think so, that change would just make it so that obj.freeze
has the effect of making obj
shareable for that class. However, prok.freeze
should never make
procs shareable, they need to go through the isolation check.
Updated by luke-gru (Luke Gruber) almost 2 years ago
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
Actions
Like0
Like0Like0Like0Like0Like0