Skip to content

Commit 839410f

Browse files
luke-gruberjhawthorn
authored andcommitted
Fix heap dump with ractor barrier
When a ractor was being initialized and it would join the heap dump barrier when allocating its queue or its ports, the heap dump code calls `rb_obj_memsize` on the ractor and this function assumed `ports` was never NULL. We need to check for the NULL case in case the ractor is still being initialized. Hopefully other T_DATA objects don't suffer from the same issue, otherwise we could revert the ractor barrier during heap dump or not use `rb_obj_memsize` on T_DATA during the heap dump.
1 parent 601ac78 commit 839410f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ractor_sync.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,12 @@ ractor_sync_free(rb_ractor_t *r)
699699
static size_t
700700
ractor_sync_memsize(const rb_ractor_t *r)
701701
{
702-
return st_table_size(r->sync.ports);
702+
if (r->sync.ports) {
703+
return st_table_size(r->sync.ports);
704+
}
705+
else {
706+
return 0;
707+
}
703708
}
704709

705710
static void

0 commit comments

Comments
 (0)