Issue #17477 has been updated by duerst (Martin D=FCrst). My preference would be to make `require` work everywhere, but always be exe= cuted in the main Reactor. That would just be part of the semantics of `req= uire`. ---------------------------------------- Bug #17477: Ractor and pp incompatibility https://bugs.ruby-lang.org/issues/17477#change-89593 * 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 =3D Ractor.new do pp("foobar") end Ractor.select(r) ``` fails with: ``` #<Thread:0x00007f973414a050 run> terminated with exception (report_on_excep= tion is true): <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require= .rb>:164:in `ensure in require': can not access non-shareable objects in co= nstant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::Iso= lationError) from <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_r= equire.rb>:167:in `require' from notractor.rb:8:in `block in <main>' <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require= .rb>:37:in `require': can not access non-shareable objects in constant Kern= el::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from notractor.rb:8:in `block in <main>' <internal:ractor>:345:in `select': thrown by remote Ractor. (Ractor::Remote= Error) from notractor.rb:11:in `<main>' <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require= .rb>:164:in `ensure in require': can not access non-shareable objects in co= nstant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::Iso= lationError) from <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_r= equire.rb>:167:in `require' from notractor.rb:8:in `block in <main>' <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require= .rb>:37:in `require': can not access non-shareable objects in constant Kern= el::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from notractor.rb:8:in `block in <main>' ``` This is easy to fix by calling `require 'pp'` in the top from the main Ract= or - but I don't think it is expected for developers. We should optimize fo= r 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: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>