From: "luke-gru (Luke Gruber) via ruby-core" Date: 2023-01-22T17:40:38+00:00 Subject: [ruby-core:111971] [Ruby master Bug#19368] Ractor.make_shareable issue/inconsistency when proc has been run that acesses outers through eval Issue #19368 has been reported by luke-gru (Luke Gruber). ---------------------------------------- Bug #19368: Ractor.make_shareable issue/inconsistency when proc has been run that acesses outers through eval https://bugs.ruby-lang.org/issues/19368 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ``` a = Object.new # non-shareable prok = Ractor.current.instance_eval do Proc.new do eval('a') end end prok.call # this should work, we're in the main ractor and the proc is not isolated Ractor.make_shareable(prok) # this doesn't currently work, but I think it should. It gives Ractor::IsolationError. See below for reasoning on why I think it should work. # A flag seems to be set on the proc after it's run and accesses outers... ``` Because this work fine: ```ruby a = Object.new # non-shareable prok = Ractor.current.instance_eval do Proc.new do eval('a') end end Ractor.make_shareable(prok) # this works, and it's okay because we get a different error when actually running the shareable proc inside a ractor that accesses outers through eval. ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/