From: "wanabe (_ wanabe) via ruby-core" Date: 2026-07-20T10:35:22+00:00 Subject: [ruby-core:126124] [Ruby Bug#19922] ObjectSpace.dump_all in multiple threads in parallel causes SEGV Issue #19922 has been updated by wanabe (_ wanabe). Status changed from Open to Closed This issue was fixed in commit `3c63a01295b4219743b3d3e883fd4a4a616960a` and has not recurred since then. Thank you. ``` $ git checkout 3c63a01295b4219743b3d3e883fd4a4a616960a6; make -j8 exts >/dev/null 2>&1 && ./ruby -v -I .ext/x86_64-linux/ -I .ext/common/ -I ../../lib -I. -robjspace -e 'def dump; 100.times { ObjectSpace.dump_all } end; Thread.new { dump }; dump; p :ok' 2>&1|head -n2 HEAD is now at 3c63a01295 Move responsibility of heap walking into Ruby ruby 3.4.0dev (2024-09-03T14:05:38Z v3_4_0_preview2~649 3c63a01295) [x86_64-linux] :ok $ git checkout 3c63a01295b4219743b3d3e883fd4a4a616960a6~; make -j8 exts >/dev/null 2>&1 && ./ruby -v -I .ext/x86_64-linux/ -I .ext/common/ -I ../../lib -I. -robjspace -e 'def dump; 100.times { ObjectSpace.dump_all } end; Thread.new { dump }; dump; p :ok' 2>&1|head -n2 Previous HEAD position was 3c63a01295 Move responsibility of heap walking into Ruby HEAD is now at a2243ee48b Implement ALIAS NODE keyword locations ruby 3.4.0dev (2024-09-03T13:09:08Z v3_4_0_preview2~650 a2243ee48b) [x86_64-linux] /home/wanabe/work/prog/ruby/ruby/tmp/master/.ext/common/objspace.rb:100: [BUG] Segmentation fault at 0x0000000000000000 ``` ---------------------------------------- Bug #19922: ObjectSpace.dump_all in multiple threads in parallel causes SEGV https://bugs.ruby-lang.org/issues/19922#change-118127 * Author: wanabe (_ wanabe) * Status: Closed * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- `ObjectSpace.dump_all` in multiple threads in parallel causes SEGV. The reproduce code is here: ``` $ ruby -robjspace -e 'def dump; 10.times { ObjectSpace.dump_all } end; Thread.new { dump }; dump' /home/wanabe/.rbenv/versions/master/lib/ruby/3.3.0+0/objspace.rb:100: [BUG] Segmentation fault at 0x0000000000000000 (snip) ``` I attached the full log. I assumed that: - Thread1 - calls `rb_objspace_reachable_objects_from_root()` - changes `GET_RACTOR()->mfd`: mfd1 - calls `dump_flush()` - changes current thread due to IO - Thread2 - calls `rb_objspace_reachable_objects_from_root()` - changes `GET_RACTOR()->mfd`: mfd2 - calls `dump_flush()` - changes current thread due to IO - Thread1 - gets unexpected `GET_RACTOR()->mfd`: mfd2 ---Files-------------------------------- bug.log (23.1 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/