From dafc4e131e782c69150ffe84184cffd8b8ec98e5 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 17 Jul 2025 12:53:43 -0400 Subject: [PATCH] Fix size assertion in concurrent set resizing Since we resize when `prev_size > set->capacity / 2`, it's possible that `prev_size == set->capacity / 2`, so we need to change the assertion in concurrent_set_try_resize_without_locking to be `new_set->size <= new_set->capacity / 2`. --- concurrent_set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concurrent_set.c b/concurrent_set.c index 876b4083e6..2aa65b7378 100644 --- a/concurrent_set.c +++ b/concurrent_set.c @@ -139,7 +139,7 @@ concurrent_set_try_resize_without_locking(VALUE old_set_obj, VALUE *set_obj_ptr) if (entry->key == CONCURRENT_SET_EMPTY) { new_set->size++; - RUBY_ASSERT(new_set->size < new_set->capacity / 2); + RUBY_ASSERT(new_set->size <= new_set->capacity / 2); RUBY_ASSERT(entry->hash == 0); entry->key = key;