ruby-changes:50432
From: k0kubun <ko1@a...>
Date: Sat, 24 Feb 2018 09:40:42 +0900 (JST)
Subject: [ruby-changes:50432] k0kubun:r62549 (trunk): mjit.c: fix deadlock on marking MJIT's ISeq
k0kubun 2018-02-24 09:40:36 +0900 (Sat, 24 Feb 2018) New Revision: 62549 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62549 Log: mjit.c: fix deadlock on marking MJIT's ISeq Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 62548) +++ mjit.c (revision 62549) @@ -1453,7 +1453,14 @@ mjit_mark(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1453 CRITICAL_SECTION_START(4, "mjit_mark"); for (node = unit_queue.head; node != NULL; node = node->next) { if (node->unit->iseq) { /* ISeq is still not GCed */ - rb_gc_mark((VALUE)node->unit->iseq); + VALUE iseq = (VALUE)node->unit->iseq; + CRITICAL_SECTION_FINISH(4, "mjit_mark rb_gc_mark"); + + /* Don't wrap critical section with this. This may trigger GC, + and in that case mjit_gc_start_hook causes deadlock. */ + rb_gc_mark(iseq); + + CRITICAL_SECTION_START(4, "mjit_mark rb_gc_mark"); } } CRITICAL_SECTION_FINISH(4, "mjit_mark"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/