https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-03-13T14:27:17ZRuby Issue Tracking SystemRuby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=846322020-03-13T14:27:17Zalanwu (Alan Wu)
<ul></ul><p>The repro also crashes on a <a href="https://github.com/ruby/ruby/commit/de15a26e9e297c9cc3171b1d40ef7776ca5838df" class="external">recent master</a>. It looks like a hash somewhere is corrupted?</p>
<pre><code>-- C level backtrace information -------------------------------------------
~/tip-de15a26/bin/ruby(rb_vm_bugreport+0xde6) [0x55ccbe087d96] vm_dump.c:763
~/tip-de15a26/bin/ruby(rb_bug+0xe4) [0x55ccbdea41a3] error.c:659
~/tip-de15a26/bin/ruby(gc_mark_ptr+0x19d) [0x55ccbdec4d5d] gc.c:5270
~/tip-de15a26/bin/ruby(mark_keyvalue+0x41) [0x55ccbdec6291] gc.c:5301
~/tip-de15a26/bin/ruby(apply_functor+0x13) [0x55ccbdff15a3] st.c:1565
~/tip-de15a26/bin/ruby(rb_st_foreach) st.c:1475
~/tip-de15a26/bin/ruby(mark_hash+0xf) [0x55ccbdec5b17] gc.c:4942
~/tip-de15a26/bin/ruby(gc_mark_children) gc.c:5491
~/tip-de15a26/bin/ruby(gc_mark_stacked_objects+0x31) [0x55ccbdec734d] gc.c:5612
~/tip-de15a26/bin/ruby(gc_mark_stacked_objects_all) gc.c:5652
~/tip-de15a26/bin/ruby(gc_marks_rest) gc.c:6552
~/tip-de15a26/bin/ruby(gc_marks+0x8) [0x55ccbdec88d8] gc.c:6611
~/tip-de15a26/bin/ruby(gc_start) gc.c:7396
~/tip-de15a26/bin/ruby(garbage_collect_with_gvl+0x90) [0x55ccbdec8d70] gc.c:7293
~/tip-de15a26/bin/ruby(objspace_malloc_fixup+0x17) [0x55ccbdecf1ab] gc.c:9865
~/tip-de15a26/bin/ruby(ruby_xmalloc) gc.c:9905
</code></pre>
<p>EDIT:<br>
Seems to be a WB miss somewhere:</p>
<pre><code>$ ruby -v crash.rb
ruby 2.8.0dev (2020-03-13T13:27:54Z master de15a26e9e) [x86_64-linux]
2.8.0
start repro (should crash after 14 dots)
.verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eea4180 [0 ] T_HASH (Hash)[S ] 9
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eeb40d0 [0 ] T_HASH (Hash)[AT] 3
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eeba9f8 [0 ] T_HASH (Hash)[AT] 3
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eeb91e8 [0 ] T_HASH (Hash)[AT] 3
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eebfbb0 [0 ] T_HASH (Hash)[AT] 3
verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055c526ceaa90 [3LM ] T_HASH (Hash)[S ] 563 -> 0x000055c52eebe6e8 [0 ] T_HASH (Hash)[AT] 7
</code></pre> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=846362020-03-14T00:30:18Zalanwu (Alan Wu)
<ul></ul><p>I bisected it to this commit:</p>
<pre><code>commit 21994b7fd686f263544fcac1616ecf3189fb78b3
Avoid rehashing keys in transform_values
Previously, calling transform_values would call rb_hash_aset for each
key, needing to rehash it and look up its location.
Instead, we can use rb_hash_stlike_foreach_with_replace to replace the
values as we iterate without rehashing the keys.
</code></pre>
<p><del>We should revert.</del> Actually I think this can be fixed easily enough. Let me take a shot.<br>
<a href="https://github.com/ruby/ruby/pull/2964" class="external">https://github.com/ruby/ruby/pull/2964</a></p> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=846622020-03-15T22:12:15Zalanwu (Alan Wu)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Add missing write barrier for Hash#transform_values{,!} 21994b7fd686f263544fcac1616ecf3189fb78b3..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/713dc619f5372a645b66bef9dacee217c4101cb4">git|713dc619f5372a645b66bef9dacee217c4101cb4</a>.</p>
<hr>
<p>Add missing write barrier for Hash#transform_values{,!}</p>
<p>21994b7fd686f263544fcac1616ecf3189fb78b3 removed the write barrier that<br>
was present in rb_hash_aset(). Re-insert it to not crash during GC.</p>
<p>[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [BUG] try to mark T_NONE object (Closed)" href="https://bugs.ruby-lang.org/issues/16689">#16689</a>]</p> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=846662020-03-16T04:34:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Backport</strong> changed from <i>2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN</i> to <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED</i></li></ul> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=846822020-03-16T13:07:19Zbyroot (Jean Boussier)byroot@ruby-lang.org
<ul></ul><p>I tested the patch against our CI and can confirm it does fix the problem.</p> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=847842020-03-26T14:51:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Backport</strong> changed from <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED</i> to <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE</i></li></ul><p>ruby_2_7 2a3027b7b54a3118731f70c9e88aabbd495bb9fe.</p> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=964102022-02-07T21:54:37ZPhilCoggins (Phil Coggins)
<ul></ul><p>Would it be possible to share the repro script that was deleted at <a href="https://github.com/Shopify/ruby-repro" class="external">https://github.com/Shopify/ruby-repro</a>? I have encountered a similar issue with <code>Hash#transform_keys</code> (see <a href="https://bugs.ruby-lang.org/issues/18575" class="external">https://bugs.ruby-lang.org/issues/18575</a>) and it would be helpful for me to provide a repro script, I think this existing one would save me some time. Thank you!</p> Ruby master - Bug #16689: [BUG] try to mark T_NONE objecthttps://bugs.ruby-lang.org/issues/16689?journal_id=964162022-02-08T08:39:34Zbyroot (Jean Boussier)byroot@ruby-lang.org
<ul></ul><p>Yeah, it must have bene deleted by some automated script, sorry. I recreated it under my personal account: <a href="https://github.com/casperisfine/ruby-bug-16689-repro" class="external">https://github.com/casperisfine/ruby-bug-16689-repro</a></p>