You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CK_STACK_FOREACH(&global->subscribers, entry) {
record = ck_hp_record_container(entry);
if (ck_pr_load_int(&record->state) == CK_HP_FREE)
continue;
if (ck_pr_load_ptr(&record->pointers) == NULL)
continue;
for (i = 0; i < global->degree; i++) {
if (hazards > CK_HP_CACHE)
break;
pointer = ck_pr_load_ptr(&record->pointers[i]);
if (pointer != NULL)
cache[hazards++] = pointer;
}
}
*n_hazards = hazards;
return (entry);
The break doesn't break out of the outer loop; only the inner one. So the return value from ck_hp_member_cache will always be NULL. This will then cause
You're right, there is a bug here when there are more hazard pointers than fit in the pre-allocated array of sorted pointer. To be fair, entering this fallback path is always a performance bug :( The overflow check would also ideally be moved all the way under the null check.
In ck_hp_reclaim there is a section
marker is seemingly meant to be non-null if the cardinality of the non-nil hazard pointers is greater than CK_HP_CACHE.
However, in ck_hp_member_cache
https://github.com/concurrencykit/ck/blob/master/src/ck_hp.c#L208
The break doesn't break out of the outer loop; only the inner one. So the return value from ck_hp_member_cache will always be NULL. This will then cause
to never execute. Am I missing something or this is just buggy?
The text was updated successfully, but these errors were encountered: