Project

General

Profile

Actions

Bug #21671

closed

Rails CI raises `Assertion Failed: rbimpl_rstring_getmem:RB_TYPE_P(str, RUBY_T_STRING): actual type: 26` with "-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" enabled

Bug #21671: Rails CI raises `Assertion Failed: rbimpl_rstring_getmem:RB_TYPE_P(str, RUBY_T_STRING): actual type: 26` with "-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" enabled

Added by yahonda (Yasuo Honda) 1 day ago. Updated about 7 hours ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-10-28T15:44:25Z master 7a736545e9) +PRISM [x86_64-linux]
[ruby-core:123717]

Description

Recently Rails CI using "-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" enabled ruby raises Assertion Failed: rbimpl_rstring_getmem:RB_TYPE_P(str, RUBY_T_STRING): actual type: 26 assertion failures.

https://buildkite.com/rails/rails-nightly/builds/3121#019a5af8-b2a1-4289-a791-3fefc14a2a41/1447-1452

Steps to reproduce

  1. Build Ruby with this configure option
./configure --prefix="/home/yahonda/.local/share/mise/installs/ruby/trunk" cppflags="-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" optflags="-O3 -fno-inline" --disable-install-doc
  1. Clone Rails repository and run Active Job integration tests
git clone https://github.com/rails/rails
cd rails/activejob
bundle update --bundler
bundle install
bundle exec rake test:integration

Expected behavior

All of tests should pass.

Actual behavior

It usually raises ./include/ruby/internal/core/rstring.h:391: Assertion Failed: rbimpl_rstring_getmem:RB_TYPE_P(str, RUBY_T_STRING): actual type: 26
I have attached the entire output as assertion_failed.log


Files

assertion_failed.log (495 KB) assertion_failed.log yahonda (Yasuo Honda), 11/07/2025 07:13 AM

Updated by yahonda (Yasuo Honda) 1 day ago Actions #1 [ruby-core:123718]

I tried to identify which commit introduces this assertion failure but not found.

Updated by byroot (Jean Boussier) about 22 hours ago Actions #2 [ruby-core:123721]

The failure comes from rb_intern3 -> sym_find_or_insert_static_symbol (during Prism parsing).

cc @luke-gru (Luke Gruber) and @jhawthorn (John Hawthorn), maybe this ring a bell?

Updated by jhawthorn (John Hawthorn) about 7 hours ago Actions #3 [ruby-core:123729]

I have a patch in https://github.com/ruby/ruby/pull/15101 that I'll merge shortly.

I believe this was an issue in at least Ruby 3.4 as well, need to test older versions. The root cause is that when certain fstrings were fed to IO#write they would be converted into a shared string (which an fstring must not be, they need to own their memory in case their hash is calculated when GC sweeping). This is probably showing up on head because of a new assertion when the table is rebuilt https://github.com/ruby/ruby/blob/a7c23b9a9f726bec7cbd6f89d157d7dd140420da/concurrent_set.c#L150

Updated by jhawthorn (John Hawthorn) about 7 hours ago Actions #4

  • Status changed from Open to Closed

Applied in changeset git|3b588dab91f13b32b54cb1b9dedb9691e732c981.


Don't modify fstrings in rb_str_tmp_frozen_no_embed_acquire

[Bug #21671]

Actions

Also available in: PDF Atom