Bug #8492

ObjectSpace.after_gc_start_hook aborts with GC.stress

Added by Yui NARUSE 11 months ago. Updated 6 months ago.

[ruby-dev:47400]
Status:Closed
Priority:Normal
Assignee:Koichi Sasada
Category:core
Target version:2.1.0
ruby -v:ruby 2.1.0dev (2013-06-05 trunk 41080) [x86_64-freebsd9.1] Backport:1.9.3: DONTNEED, 2.0.0: DONTNEED

Description

以下を実行すると assert(duringgc > 0) に失敗して abort します。
ruby -robjspace -e'ObjectSpace.after
gcstarthook=proc{};GC.stress=true;{}'
gc.c:3818 の
gceventhook(objspace, RUBYINTERNALEVENTGCSTART, 0 /* TODO: pass minor/immediate flag? */);
実行後に、during_gc が 0 になっている模様。

Associated revisions

Revision 43245
Added by Nobuyoshi Nakada 6 months ago

vm_trace.c: fix infinite hook

  • thread.c (rbthreadptrexecute_interrupts): flush postponed job only once at last.
  • vmtrace.c (rbpostponedjobflush): defer calling postponed jobs registered while flushing to get rid of infinite reentrance of ObjectSpace.aftergcstart_hook. [Bug #8492]

History

#1 Updated by Koichi Sasada 6 months ago

随分放置してしまってすみません。
これ、今でもなりますか? 手元ではなんか

$ ./ruby -robjspace -e'ObjectSpace.aftergcstart_hook=proc{};GC.stress=true;{}'
セグメンテーション違反です

などと出てしまう。これはこれでまずかろう、という気もしますが...。

#2 Updated by Nobuyoshi Nakada 6 months ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43245.
Yui, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vm_trace.c: fix infinite hook

  • thread.c (rbthreadptrexecute_interrupts): flush postponed job only once at last.
  • vmtrace.c (rbpostponedjobflush): defer calling postponed jobs registered while flushing to get rid of infinite reentrance of ObjectSpace.aftergcstart_hook. [Bug #8492]

#3 Updated by Tomoyuki Chikanaga 6 months ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED

Also available in: Atom PDF