Skip to content

Conversation

byroot
Copy link
Member

@byroot byroot commented Mar 6, 2025

[Bug #21172]

This fixes a rare CI failure.

The timeline of the race condition is:

  • A "foo" oid=1 string is interned.
  • "foo" oid=1 is no longer referenced and will be swept in the future.
  • Another "foo" oid=2 string is interned.
  • register_fstring finds "foo" oid=1, but since it is about to be swept, removes it from fstring_table and insert "foo" oid=2 instead.
  • "foo" oid=1 is swept, since it has the RSTRING_FSTR flag, a st_delete is issued in fstring_table which removes "foo" oid=2.

I don't know how to reproduce this bug consistently in a single test case.

[Bug #21172]

This fixes a rare CI failure.

The timeline of the race condition is:

- A `"foo" oid=1` string is interned.
- `"foo" oid=1` is no longer referenced and will be swept in the future.
- Another `"foo" oid=2` string is interned.
- `register_fstring` finds `"foo" oid=1`, but since it is about to be swept,
  removes it from `fstring_table` and insert `"foo" oid=2` instead.
- `"foo" oid=1` is swept, since it has the `RSTRING_FSTR` flag,
  a `st_delete` is issued in `fstring_table` which removes `"foo" oid=2`.

I don't know how to reproduce this bug consistently in a single test
case.
@byroot byroot requested a review from k0kubun as a code owner March 6, 2025 14:42
@k0kubun k0kubun merged commit 161cffb into ruby:ruby_3_4 Mar 6, 2025
77 checks passed
@hsbt hsbt added the Backport label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants