ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: duerst@it.aoyama.ac.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:101766] [Ruby master Bug#17477] Ractor and pp incompatibility
Date: Mon, 28 Dec 2020 02:25:44 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-89593.20201228022544.8653@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17477.20201227081419.8653@ruby-lang.org

Issue #17477 has been updated by duerst (Martin Dürst).


My preference would be to make `require` work everywhere, but always be executed in the main Reactor. That would just be part of the semantics of `require`.

----------------------------------------
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 = Ractor.new do
  pp("foobar")
end
Ractor.select(r)
```

fails with:

```
#<Thread:0x00007f973414a050 run> terminated with exception (report_on_exception 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 constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
	from <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.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 Kernel::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::RemoteError)
	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 constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
	from <internal:/opt/rubies/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.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 Kernel::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 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

  parent reply	other threads:[~2020-12-28  2:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27  8:14 [ruby-core:101731] [Ruby master Bug#17477] Ractor and pp incompatibility shatrov
2020-12-27 16:20 ` [ruby-core:101749] " eregontp
2020-12-28  2:25 ` duerst [this message]
2020-12-28  6:47 ` [ruby-core:101769] " marcandre-ruby-core
2020-12-29  9:12 ` [ruby-core:101805] " shatrov
2021-01-05  1:41 ` [ruby-core:101921] " ko1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-89593.20201228022544.8653@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).