Skip to content

Commit

Permalink
Revert "Fix crash caused by concurrent ObjectSpace.dump_all calls"
Browse files Browse the repository at this point in the history
This reverts commit 9a62fd3.
  • Loading branch information
byroot committed Nov 13, 2023
1 parent 9ca41e9 commit a1887f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 1 addition & 5 deletions gc.c
Expand Up @@ -11935,11 +11935,7 @@ static void
reachable_objects_from_callback(VALUE obj)
{
rb_ractor_t *cr = GET_RACTOR();
struct gc_mark_func_data_struct *cur_mfd = cr->mfd;
cur_mfd->mark_func(obj, cr->mfd->data);
/* mark_func might give up the GVL, in which time some other thread might set
mfd. In that case, set it back to the right value for this thread. */
cr->mfd = cur_mfd;
cr->mfd->mark_func(obj, cr->mfd->data);
}

void
Expand Down
8 changes: 0 additions & 8 deletions test/objspace/test_objspace.rb
Expand Up @@ -918,14 +918,6 @@ def test_dump_shapes
assert_equal 2, ObjectSpace.dump_shapes(output: :string, since: RubyVM.stat(:next_shape_id) - 2).lines.size
end

def test_dump_all_in_parallel_bug_19922
dump_ten_times = ->() { 10.times { ObjectSpace.dump_all.tap { _1.close } } }
t = Thread.new { dump_ten_times.call }
dump_ten_times.call
t.value
# Bug #19922 would cause this test to crash.
end

private

def utf8_❨╯°□°❩╯︵┻━┻
Expand Down

0 comments on commit a1887f4

Please sign in to comment.