Takashi Kokubun aca385b2a1 [ruby/mmtk] Wait for a pending GC before re-disabling GC after GC.start
GC.start runs even while GC is disabled, so mmtk_handle_user_collection_request
enables GC around the collection and disables it again afterward. While GC is
enabled, another Ractor's GC.start can request a GC that hasn't run yet when
this thread tries to re-disable GC. disable_collection fails in that state,
and we panicked with "failed to re-disable GC after GC".

This showed up as an intermittent crash of test_ractor_nt_switch.rb's
gc_finalize_deferred test on the MMTk CI. Instead of panicking, block for the
pending GC and try again. Since a GC is already requested, the retry joins it
instead of starting a new one.

https://github.com/ruby/mmtk/commit/3c6c503c50
2026-11-05 03:59:45 +00:00
..
…