Project

General

Profile

Actions

Bug #22105

open

Cannot initialize a WeakRef in a Ractor

Bug #22105: Cannot initialize a WeakRef in a Ractor

Added by miles-georgi (Miles Georgi) 3 days ago. Updated 3 days ago.

Status:
Open
Assignee:
Target version:
-
ruby -v:
ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [x86_64-linux]
[ruby-core:125705]

Description

Hey hey!

If I try to create a WeakRef in a Ractor, like in this script:

require "weakref"

Ractor.new { WeakRef.new("asdf") }.join

Then I get this error:

4.1-dev/lib/ruby/4.1.0+3/weakref.rb:40:in 'WeakRef#initialize': can not read non-shareable class variable @@__map from non-main Ractors (WeakRef) (Ractor::IsolationError)

This happens in both a local build of 4.1-dev and 4.0.5 and likely other versions.

Updated by jhawthorn (John Hawthorn) 3 days ago Actions #1

  • Assignee set to ractor
Actions

Also available in: PDF Atom