Issue #15809 has been updated by wanabe (_ wanabe). wanabe (_ wanabe) wrote: > How about delaying `gc_finalize_deferred()` phase after `gc_update_references()`? Like this: ``` diff --git a/gc.c b/gc.c index ea4f54ce0e..68d58fcb5e 100644 --- a/gc.c +++ b/gc.c @@ -8100,14 +8100,17 @@ static VALUE rb_gc_compact(VALUE mod) { rb_objspace_t *objspace = &rb_objspace; + int reason = GPR_FLAG_FULL_MARK | GPR_FLAG_IMMEDIATE_MARK | + GPR_FLAG_IMMEDIATE_SWEEP | GPR_FLAG_CAPI; /* Ensure objects are pinned */ - rb_gc(); + garbage_collect(objspace, reason); gc_compact_heap(objspace); heap_eden->freelist = NULL; gc_update_references(objspace); + gc_finalize_deferred(objspace); rb_clear_method_cache_by_class(rb_cObject); rb_clear_constant_cache(); @@ -8191,14 +8194,17 @@ static VALUE gc_verify_compaction_references(VALUE mod) { rb_objspace_t *objspace = &rb_objspace; + int reason = GPR_FLAG_FULL_MARK | GPR_FLAG_IMMEDIATE_MARK | + GPR_FLAG_IMMEDIATE_SWEEP | GPR_FLAG_CAPI; /* Ensure objects are pinned */ - rb_gc(); + garbage_collect(objspace, reason); gc_compact_heap(objspace); heap_eden->freelist = NULL; gc_update_references(objspace); + gc_finalize_deferred(objspace); gc_check_references_for_moved(mod); rb_clear_method_cache_by_class(rb_cObject); ``` But I think it needs a refactoring because of duplicated code. ---------------------------------------- Bug #15809: GC.verify_compaction_references - intermittent SEGV's on multiple platforms https://bugs.ruby-lang.org/issues/15809#change-77977 * Author: MSP-Greg (Greg L) * Status: Assigned * Priority: Normal * Assignee: tenderlovemaking (Aaron Patterson) * Target version: * ruby -v: ruby 2.7.0dev (2019-05-06 trunk c3cf1ef9bb) [x64-mingw32 * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- See https://travis-ci.org/ruby/ruby/jobs/525627187#L2684 https://ci.appveyor.com/project/ruby/ruby/builds/24138134/job/i7e441u7se11w7ey#L3402 Both have an error similar to: ``` /ruby/test/ruby/test_gc_compact.rb:128: [BUG] ROOT finalizers points to MOVED: 0x0000000004679c20 -> 0x00000000089367c0 [0 ] T_ARRAY [E ] len: 1 (embed) ``` ruby-loco has also failed with a similar error. Attached STDERR output. ---Files-------------------------------- test_all_err.log (42 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>