Project

General

Profile

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`

Added by yahonda (Yasuo Honda) 3 days ago. Updated about 2 hours ago.

Status:
Open
Assignee:
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-07-02T09:24:35Z master 7c69f93d53) +PRISM [x86_64-linux]
[ruby-core:125915]

Description

This issue is originally found at https://github.com/rails/rails/issues/57954

Steps to reproduce

  1. Build ruby with -DRUBY_DEBUG=1 enabled 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
  1. Run these one liners
ruby -ve 'Ractor.new { Fiber.current }.value'
ruby -ve 'Fiber[:x] = Object.new; Ractor.new { Fiber[:x].class }.value'

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

1.out (23.8 KB) 1.out Ractor.new { Fiber.current }.value result with -DRUBY_DEBUG=1 yahonda (Yasuo Honda), 07/02/2026 10:21 AM
2.out (23.8 KB) 2.out Fiber[:x] = Object.new; Ractor.new { Fiber[:x].class }.value result with -DRUBY_DEBUG=1 yahonda (Yasuo Honda), 07/02/2026 10:21 AM

Updated by luke-gru (Luke Gruber) 3 days ago Actions #1

  • Assignee set to ractor

Updated by yahonda (Yasuo Honda) about 2 hours ago Actions #2 [ruby-core:125935]

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

Also available in: PDF Atom