From: marcandre-ruby-core@... Date: 2020-12-01T00:34:54+00:00 Subject: [ruby-core:101170] [Ruby master Bug#17344] `Ractor#shareable?` confused by recursive structures Issue #17344 has been updated by marcandre (Marc-Andre Lafortune). Thanks Nobu. Same issue was still present with `Ractor.make_shareable`, which I fixed in https://github.com/ruby/ruby/pull/3827 Please let me know if I missed something. ---------------------------------------- Bug #17344: `Ractor#shareable?` confused by recursive structures https://bugs.ruby-lang.org/issues/17344#change-88856 * Author: marcandre (Marc-Andre Lafortune) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: 3.0 * ruby -v: ruby 3.0.0dev (2020-11-26T00:37:38Z master af80df1820) [x86_64-darwin17] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ```ruby y = []; x = [y, {}].freeze; y << x; y.freeze Ractor.shareable?(y) # => false, ok, the `{}` is not frozen Ractor.shareable?(x) # => false, ok Ractor.shareable?(y) # => true, not ok! ``` The error is that we can not mark anything as shareable until the whole tree has been searched successfully. Only when the full traversal is successful, then all visited objects can be marked as shareable. There might be a more clever way, but I couldn't think of one when working on my backport. -- https://bugs.ruby-lang.org/ Unsubscribe: