[ruby-core:111992] [Ruby master Bug#19372] Proc objects are not traversed for shareable check during Ractor.make_shareable(prok)

Issue #19372 has been reported by luke-gru (Luke Gruber). ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19372 has been updated by luke-gru (Luke Gruber). A separate but related issue is that the proc objects are not frozen too, so their ivars can be (re)assigned. ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372#change-101428 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19372 has been updated by nobu (Nobuyoshi Nakada). Maybe https://github.com/nobu/ruby/tree/ractor-unshareable-data fixes it? ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372#change-101430 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19372 has been updated by luke-gru (Luke Gruber). No I don't think so, that change would just make it so that `obj.freeze` sometimes has the effect of making `obj` shareable. However, `prok.freeze` should never make procs shareable, they need to go through the isolation check. ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372#change-101452 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19372 has been updated by luke-gru (Luke Gruber). PR here: https://github.com/ruby/ruby/pull/7182 ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372#change-101464 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19372 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Assigned Assignee set to ko1 (Koichi Sasada) ---------------------------------------- Bug #19372: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) https://bugs.ruby-lang.org/issues/19372#change-101681 * Author: luke-gru (Luke Gruber) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/
participants (3)
-
hsbt (Hiroshi SHIBATA)
-
luke-gru (Luke Gruber)
-
nobu (Nobuyoshi Nakada)