From: "byroot (Jean Boussier) via ruby-core" Date: 2025-03-16T11:19:25+00:00 Subject: [ruby-core:121383] [Ruby Bug#21172] Race condition in `register_fstring` Issue #21172 has been updated by byroot (Jean Boussier). Backport changed from 3.1: WONTFIX, 3.2: WONTFIX, 3.3: DONE, 3.4: REQUIRED to 3.1: WONTFIX, 3.2: WONTFIX, 3.3: DONE, 3.4: DONE https://github.com/ruby/ruby/pull/12873 ---------------------------------------- Bug #21172: Race condition in `register_fstring` https://bugs.ruby-lang.org/issues/21172#change-112354 * Author: byroot (Jean Boussier) * Status: Closed * Backport: 3.1: WONTFIX, 3.2: WONTFIX, 3.3: DONE, 3.4: DONE ---------------------------------------- This is a rare bug with very low criticality, but it can cause occasional CI failures. I leave it to branch maintainers to decide if it's worth backporting or not. ### Timeline - 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`. Unfortunately, I couldn't come up with a minimal reproduction for this, but it did reproduce consistently with a large amount of tests and a very specific seed. ### Consequence This has little to no consequence on real world code. It just breaks a few ruby tests that is attempting to ensure some strings were interned. Example: ``` 1) Failure: JSONParserTest#test_freeze [/tmp/ruby/src/trunk/test/json/json_parser_test.rb:361]: Expected "foo" (oid=416) to be the same as "foo" (oid=424). make: *** [uncommon.mk:953: yes-test-all] Error 1 ``` -- 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/