Project

General

Profile

Actions

Bug #17344

closed

`Ractor#shareable?` confused by recursive structures

Added by marcandre (Marc-Andre Lafortune) about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 3.0.0dev (2020-11-26T00:37:38Z master af80df1820) [x86_64-darwin17]
[ruby-core:101088]

Description

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.

Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|930a135524382ddd80c0608a7593b6cdfceee846.


Fixed Ractor.shareable? on cross-recursive objects [Bug #17344]

Updated by marcandre (Marc-Andre Lafortune) almost 2 years ago

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0