Project

General

Profile

Actions

Bug #21354

open

Symbol#to_proc is not ractor safe

Added by luke-gru (Luke Gruber) about 16 hours ago. Updated about 6 hours ago.

Status:
Open
Target version:
-
[ruby-core:122208]

Description

There is caching in Symbol#to_proc (rb_sym_to_proc) that makes the assumption that we're always in the main ractor. With multiple ractors, this caching logic is not ractor-safe in that cached procs created in one ractor can leak into other ractors. In a debug build, this results in a ractor_confirm_belonging assertion failure.

Ruby code that reproduces the issue:

  :inspect.to_proc
  Ractor.new do
    :inspect.to_proc
  end.take

Updated by luke-gru (Luke Gruber) about 16 hours ago ยท Edited

PR here: https://github.com/ruby/ruby/pull/13380

We are looking at how to make the cache ractor safe but it will be done in a separate PR.

Updated by nobu (Nobuyoshi Nakada) about 6 hours ago

  • Assignee set to ko1 (Koichi Sasada)
  • Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
Actions

Also available in: Atom PDF

Like0
Like0Like0