From: eregontp@... Date: 2020-12-27T16:20:32+00:00 Subject: [ruby-core:101749] [Ruby master Bug#17477] Ractor and pp incompatibility Issue #17477 has been updated by Eregon (Benoit Daloze). I doubt `require` can ever be supported in a Ractor, see #17420. It seems there is no good solution for this, and besides this problem not only happens with `pp` but with any kind of "autoloaded" library/gem. ---------------------------------------- Bug #17477: Ractor and pp incompatibility https://bugs.ruby-lang.org/issues/17477#change-89573 * Author: kirs (Kir Shatrov) * Status: Open * Priority: Normal * ruby -v: 3.0.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ```ruby r = Ractor.new do pp("foobar") end Ractor.select(r) ``` fails with: ``` # terminated with exception (report_on_exception is true): :164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from :167:in `require' from notractor.rb:8:in `block in
' :37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from notractor.rb:8:in `block in
' :345:in `select': thrown by remote Ractor. (Ractor::RemoteError) from notractor.rb:11:in `
' :164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from :167:in `require' from notractor.rb:8:in `block in
' :37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from notractor.rb:8:in `block in
' ``` This is easy to fix by calling `require 'pp'` in the top from the main Ractor - but I don't think it is expected for developers. We should optimize for developer's happiness and either make it just work or make it clear that everything should be required beforehand. -- https://bugs.ruby-lang.org/ Unsubscribe: