diff options
| author | KJ Tsanaktsidis <ktsanaktsidis@zendesk.com> | 2023-11-07 22:08:34 +1100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2023-11-12 17:50:37 +0100 |
| commit | 9a62fd3cbae2ebb60e2f9cad782af1ad18db4319 (patch) | |
| tree | e647e33b74ca3b4731322aa9d60f1ec5d161b2d0 /test | |
| parent | 76dc327eeffefe02577999fe5f8215f762a581b6 (diff) | |
Fix crash caused by concurrent ObjectSpace.dump_all calls
Since the callback defined in the objspace module might give up the GVL,
we need to make sure the right cr->mfd value is set back after the GVL
is re-obtained.
Diffstat (limited to 'test')
| -rw-r--r-- | test/objspace/test_objspace.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 1f1709fb76..1a8d7a24ba 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -918,6 +918,14 @@ class TestObjSpace < Test::Unit::TestCase 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_❨╯°□°❩╯︵┻━┻ |
