From: "k0kubun (Takashi Kokubun) via ruby-core" Date: 2025-07-14T21:10:27+00:00 Subject: [ruby-core:122755] [Ruby Bug#21354] Symbol#to_proc is not ractor safe Issue #21354 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED to 3.2: REQUIRED, 3.3: DONE, 3.4: DONE ruby_3_4 commit:82e05dc945e3e2c5ab22be661f6caf6c7436461f merged revision(s) commit:f6cbf499bc98b851034fffb49fcbb59d495f6f7b. ---------------------------------------- Bug #21354: Symbol#to_proc is not ractor safe https://bugs.ruby-lang.org/issues/21354#change-114034 * Author: luke-gru (Luke Gruber) * Status: Closed * Assignee: ractor * Backport: 3.2: REQUIRED, 3.3: DONE, 3.4: DONE ---------------------------------------- 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: ```ruby :inspect.to_proc Ractor.new do :inspect.to_proc end.take ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/