Actions
Bug #22173
open`Ractor.new { Fiber.current }.value` raises `[BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2`
Bug #22173:
`Ractor.new { Fiber.current }.value` raises `[BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2`
ruby -v:
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
Description
This issue is originally found at https://github.com/rails/rails/issues/57954
Steps to reproduce¶
- Build ruby with
-DRUBY_DEBUG=1enabled like
#!/bin/bash
cd ${HOME}/src/github.com/ruby/ruby
make clean
make distclean
make realclean
./autogen.sh
./configure --prefix="${HOME}/.local/share/mise/installs/ruby/trunk" cppflags="-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" optflags="-O3 -fno-inline" --disable-install-doc
make -j"$(getconf _NPROCESSORS_ONLN)"
make install
- Run these one liners
Expected behavior¶
Both of one liners should pass:
$ ruby -ve 'Ractor.new { Fiber.current }.value'
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
$ ruby -ve 'Fiber[:x] = Object.new; Ractor.new { Fiber[:x].class }.value'
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
Actual behavior¶
Both of them raise the [BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2 assertion failures added through https://github.com/ruby/ruby/commit/af2471365fe
$ ruby -ve 'Ractor.new { Fiber.current }.value'
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
<OBJ_INFO:rb_ractor_confirm_belonging@ractor_core.h:329> 0x000078fa403213d0 fiber/Fiber
-e:1: [BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
...
$ ruby -ve 'Fiber[:x] = Object.new; Ractor.new { Fiber[:x].class }.value'
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
<OBJ_INFO:rb_ractor_confirm_belonging@ractor_core.h:329> 0x00007e56dbe9dfa8 T_OBJECT/Object len:0 capa:2 ptr:0x00007e56dbe9dfb8
-e:1: [BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
Files
Updated by luke-gru (Luke Gruber) 3 days ago
- Assignee set to ractor
Updated by yahonda (Yasuo Honda) about 2 hours ago
Confirmed https://github.com/ruby/ruby/commit/f5ef758a756b325208c9d052326bb64239e4b1aa fixed the second one.
$ ruby -ve 'Fiber[:x] = Object.new; Ractor.new { Fiber[:x].class }.value'
ruby 4.1.0dev (2026-07-03T01:34:54Z master f5ef758a75) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
The first one still get the same assertion failure.
$ ruby -ve 'Ractor.new { Fiber.current }.value'
ruby 4.1.0dev (2026-07-03T01:34:54Z master f5ef758a75) +PRISM [x86_64-linux]
-e:1: warning: Ractor API is experimental and may change in future versions of Ruby.
<OBJ_INFO:rb_ractor_confirm_belonging@ractor_core.h:329> 0x00007917188d1380 fiber/Fiber
-e:1: [BUG] rb_ractor_confirm_belonging object-ractor id:1, current-ractor id:2
ruby 4.1.0dev (2026-07-03T01:34:54Z master f5ef758a75) +PRISM [x86_64-linux]
Actions