Skip to content

Concurrent set fix when encountering garbage obj in find_or_insert - #16701

Merged
luke-gru merged 1 commit into
ruby:masterfrom
luke-gruber:concurrent_set_garbage_obj_size_fix
Apr 13, 2026
Merged

luke-gru merged 1 commit into
ruby:masterfrom
luke-gruber:concurrent_set_garbage_obj_size_fix

Conversation

@luke-gruber

Copy link
Copy Markdown
Contributor

When CASing the garbage key to EMPTY, if we succeed we should decrease set->size because we're trying to re-insert into the same slot right after. The insertion increases set->size if it succeeds. This issue can lead to set->size being overcounted, which can lead to more table resizes.

@luke-gru
luke-gru requested a review from jhawthorn April 9, 2026 18:46
When CASing the garbage key to EMPTY, if we succeed we should decrease
set->size because we're trying to re-insert into the same slot right after.
The insertion increases set->size if it succeeds. This issue can lead to
set->size being overcounted, which can lead to more table resizes.
@luke-gruber
luke-gruber force-pushed the concurrent_set_garbage_obj_size_fix branch from 2f28555 to 4049269 Compare April 9, 2026 21:00
@luke-gru
luke-gru merged commit ee90e8e into ruby:master Apr 13, 2026
97 of 99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants