Skip to content

Ruby 3 Ractor support? #644

Description

@zt2

Ruby 3 support Ractor to archive concurrency, Ractor can not access instance variables of classes/modules.

When I want to use Ractor with http, I found http is using access instance variables of classes, for example:

require 'http'

ractors = []
url = 'http://httpbin.org/ip'
10.times do
  ractors << Ractor.new(url) { |u| HTTP.get u }
end
ractors.map(&:take)

This snippet will raise error http-4.4.1/lib/http/chainable.rb:221:in 'default_options': can not access instance variables of classes/modules from non-main Ractors (Ractor::IsolationError), because http using default_options as class instance variable.

Is it possible to make it support Ractor?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions