https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-04-30T02:18:04ZRuby Issue Tracking SystemRuby master - Bug #9787: r45698 causes a segv in Rails testshttps://redmine.ruby-lang.org/issues/9787?journal_id=463752014-04-30T02:18:04Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Aaron Patterson wrote:</p>
<blockquote>
<pre><code> frame #7: 0x0000000104c2545c ruby`rb_gc_resurrect(obj=73328908) + 28 at gc.c:3656
</code></pre>
</blockquote>
<p><code>73328908</code> is <code>0x45ee90c</code>, so it is a static symbol.</p>
<blockquote>
<pre><code> frame #8: 0x0000000104c80f6e ruby`rb_id_attrset [inlined] rb_pin_dynamic_symbol(sym=73328908) + 8 at parse.y:10469
frame #9: 0x0000000104c80f66 ruby`rb_id_attrset(id=73328908) + 182 at parse.y:8866
</code></pre>
</blockquote>
<p>Seems "new" ID with "=" was not actually new, but it has been interned in C level.</p>
<p>Does this fix it?</p>
<pre><code class="diff syntaxhl" data-language="diff"><span class="gh">diff --git a/parse.y b/parse.y
index 290eb75..5046e9e 100644
</span><span class="gd">--- a/parse.y
</span><span class="gi">+++ b/parse.y
</span><span class="p">@@ -8863,7 +8863,11 @@</span> rb_id_attrset(ID id)
str = rb_str_dup(RSYMBOL((VALUE)id)->fstr);
rb_str_cat(str, "=", 1);
id = (ID)rb_str_dynamic_intern(str);
<span class="gd">- rb_pin_dynamic_symbol((VALUE)id);
</span><span class="gi">+ if (ID_DYNAMIC_SYM_P(id)) {
+ /* attrset ID may have been registered as a static
+ * symbol */
+ rb_pin_dynamic_symbol((VALUE)id);
+ }
</span> }
return id;
}
</code></pre> Ruby master - Bug #9787: r45698 causes a segv in Rails testshttps://redmine.ruby-lang.org/issues/9787?journal_id=463762014-04-30T02:19:01Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>nobu (Nobuyoshi Nakada)</i></li><li><strong>Target version</strong> set to <i>2.2.0</i></li><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: UNKNOWN</i> to <i>2.0.0: DONTNEED, 2.1: DONTNEED</i></li></ul> Ruby master - Bug #9787: r45698 causes a segv in Rails testshttps://redmine.ruby-lang.org/issues/9787?journal_id=464022014-04-30T08:07:00Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset r45756.</p>
<hr>
<p>parse.y: pin down dynamic symbol only</p>
<ul>
<li>parse.y (rb_id_attrset): pin down dynamic symbol only. it is<br>
possibe that attrset ID can be registered as a static symbol<br>
after the corresponding attrget ID has been registered as a<br>
dynamic, and then the latter may be collected.<br>
<a href="/issues/9787">[ruby-core:62226]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: r45698 causes a segv in Rails tests (Closed)" href="https://redmine.ruby-lang.org/issues/9787">#9787</a>]</li>
</ul> Ruby master - Bug #9787: r45698 causes a segv in Rails testshttps://redmine.ruby-lang.org/issues/9787?journal_id=464172014-04-30T17:25:49Ztenderlovemaking (Aaron Patterson)tenderlove@ruby-lang.org
<ul></ul><p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/4">@nobu (Nobuyoshi Nakada)</a> the segv seems fixed, but now we get an error:</p>
<pre><code>/Users/aaron/git/rails/activesupport/lib/active_support/dependencies.rb:247:in `require': wrong argument type Symbol (expected Symbol) (TypeError)
from /Users/aaron/git/rails/activesupport/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/aaron/git/rails/activesupport/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/aaron/git/rails/activesupport/lib/active_support/dependencies.rb:247:in `require'
from /Users/aaron/.rbenv/versions/2.1.0-dev/lib/ruby/gems/2.2.0/gems/rake-10.3.1/lib/rake/rake_test_loader.rb:15:in `block in <main>'
from /Users/aaron/.rbenv/versions/2.1.0-dev/lib/ruby/gems/2.2.0/gems/rake-10.3.1/lib/rake/rake_test_loader.rb:4:in `select'
from /Users/aaron/.rbenv/versions/2.1.0-dev/lib/ruby/gems/2.2.0/gems/rake-10.3.1/lib/rake/rake_test_loader.rb:4:in `<main>'
</code></pre>
<p>I'll try to reduce the code to a small example.</p>