Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with Ractors (Ruby 3) #101

Open
mvidner opened this issue Mar 9, 2022 · 1 comment
Open

does not work with Ractors (Ruby 3) #101

mvidner opened this issue Mar 9, 2022 · 1 comment
Labels
d-installer relevant for https://github.com/yast/d-installer

Comments

@mvidner
Copy link
Owner

mvidner commented Mar 9, 2022

A Ractor is a Ruby 3 mechanism for concurrency, where the basic difference to threads is that everything is isolated, except the things that you explicitly want to share.

To make this work, code that runs in a Ractor must conform to certain limitations:

  • no @@class_variables (ruby-dbus: Message#@@serial)
  • no @instance_variables of Modules/Classes (ruby-dbus: DBus#@logger)
  • ENV is not shareable yet (https://bugs.ruby-lang.org/issues/17676), several uses in ruby-dbus for the session bus
  • (and so on)

It appears fixable but not trivial.

@mvidner mvidner added the d-installer relevant for https://github.com/yast/d-installer label Mar 9, 2022
@mvidner
Copy link
Owner Author

mvidner commented Mar 22, 2022

Some snippets to reproduce the problems:

export RUBYLIB=lib
ruby -r dbus -e 'p DBus::ASessionBus.new.proxy.ListNames.first.size' # this works
ruby -r dbus -e 'r = Ractor.new { p DBus::ASessionBus.new.proxy.ListNames.first.size }; r.take' # fails on ENV
ruby -r dbus -e 'r = Ractor.new { p DBus::ASystemBus.new.proxy.ListNames.first.size }; r.take' # fails on class var
# how ENV fails
ruby -e 'r = Ractor.new { p ENV["HOME"] }; r.take' 
ruby -e 'r = Ractor.new { env = Ractor.make_shareable(ENV); p env["HOME"] }; r.take'

mvidner added a commit that referenced this issue Mar 22, 2022
- avoid RbConfig, sacrificing FreeBSD
- make DBus.logger Ractor-local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d-installer relevant for https://github.com/yast/d-installer
Projects
None yet
Development

No branches or pull requests

1 participant