
Issue #20255 has been updated by luke-gru (Luke Gruber). Hi Jean, thanks for taking care of this issue. Your change makes sense to me but I have a small concern regarding the potential call to `initialize_clone`. When allowing user-defined hooks like this in Ractor move logic, the user can add a non-shareable object. For example: ```ruby a = [1, 2, 3] NON_SHAREABLE = Object.new p "outside: #{NON_SHAREABLE}" def a.initialize_clone(other) super instance_variable_set("@non_shareable", NON_SHAREABLE) end r = Ractor.new do obj = Ractor.receive p "inside: #{obj.instance_variable_get("@non_shareable")}" end r.send(a, move: true) r.take ``` ---------------------------------------- Bug #20255: Embedded arrays aren't moved correctly across ractors https://bugs.ruby-lang.org/issues/20255#change-112504 * Author: luke-gru (Luke Gruber) * Status: Closed * Assignee: ko1 (Koichi Sasada) * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- `ractor.send(ary, move: true)` works incorrectly because if `ary` is embedded, the new moved object doesn't populate its own embedded space, it uses the MovedObject's embedded space. example: ```ruby r = Ractor.new { inner_ary = receive values = {} values[:equal] = (inner_ary == ["",{},2,3,4,5,6]) values[:string] = inner_ary.to_s values } ary = [String.new,Hash.new,2,3,4,5,6] r.send(ary, move: true) r_values = r.take p r_values[:equal] p r_values[:string] # => false # => "[\"\", {}, 2, 2.0, 21747991570, String, 3]" ``` -- https://bugs.ruby-lang.org/