https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-12-30T18:28:19ZRuby Issue Tracking SystemRuby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439622013-12-30T18:28:19Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul><li><strong>File</strong> <a href="/attachments/4120">rb_mod_const_missing.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4120/rb_mod_const_missing.patch">rb_mod_const_missing.patch</a> added</li></ul><p>I believe the attached patch fixes the problem.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439672013-12-30T20:05:22Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul><li><strong>File</strong> <a href="/attachments/4122">rb_mod_const_missing_with_tests.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4122/rb_mod_const_missing_with_tests.patch">rb_mod_const_missing_with_tests.patch</a> added</li></ul><p>added tests to patch.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439682013-12-30T20:06:21Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>I believe this bug also exists in 1.9.3 and 2.0.0.</p>
<p>Any chance to backport?</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439692013-12-30T20:55:01Ztmm1 (Aman Karmani)ruby@tmm1.net
<ul></ul><p>Thanks for adding the test.</p>
<p>Seems like <code>rb_frame_pop()</code> should probably emit the event, but I'm not sure how to tell klass/mid in there.</p>
<p>BTW, doesn't this problem happen anytime an exception is raised? One or more stack frames can disappear without corresponding events.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439702013-12-30T21:21:50Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>rb_frame_pop is called in only one place, and that's the one which the patch addresses.</p>
<p>So yes, we could move the code to rb_frame_pop(), if we change it's signature.</p>
<p>I'm not sure, under which circumstances the problem can show it's ugly head.</p>
<p>This breaks (without patch):</p>
<p>def foo; UNKNOWN_CONSTANT rescue nil; end</p>
<p>These don't:</p>
<p>def foo; 1/0 rescue nil; end<br>
def bar; raise "shoot" rescue nil; end</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439912013-12-31T18:55:53Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>The patch has some issues with redefined Module#const_missing.</p>
<p>I'm in the process of preparing a new one.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439932013-12-31T19:35:21Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>Here's the new patch. I have moved the hook to rb_frame_pop().</p>
<p>The new patch makes sure that the method names sent along with call and return events are identical.</p>
<p>But I'm not sure whether the current ruby behavior in the presence of aliased methods is really the desired behavior.</p>
<p>Looking forward to feedback on this topic.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439942013-12-31T19:39:06Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul><li><strong>File</strong> <a href="/attachments/4130">rb_mod_const_missing_with_tests_redefined.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4130/rb_mod_const_missing_with_tests_redefined.patch">rb_mod_const_missing_with_tests_redefined.patch</a> added</li></ul> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=439962013-12-31T21:24:11Zko1 (Koichi Sasada)
<ul></ul><p>The last patch is not acceptable because of performance reason.</p>
<p>I'll think about it.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440002014-01-01T08:31:42Ztmm1 (Aman Karmani)ruby@tmm1.net
<ul></ul><p>I like the second patch, but now I'm not so sure about this technique.</p>
<p>Technically, const_missing never returns. So emitting a c_return event seems wrong. In fact, a raise event should be emitted from inside const_missing.</p>
<p>The "right" way to deal with this in ruby-prof would be to listen for the raise event and unwind the internal representation of the stack accordingly. Unfortunately, this is kind of tricky to implement.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440192014-01-02T20:30:38Ztmm1 (Aman Karmani)ruby@tmm1.net
<ul></ul><p>In rblineprof, I maintain a stack of CALL events. When a RETURN event comes in, CALL entries on the internal stack are popped until one matching the RETURN is found.</p>
<p><a href="https://github.com/tmm1/rblineprof/blob/32795afc748f2f51cf76ce20ef6a85f50b9278c6/ext/rblineprof.c#L471-L475" class="external">https://github.com/tmm1/rblineprof/blob/32795afc748f2f51cf76ce20ef6a85f50b9278c6/ext/rblineprof.c#L471-L475</a></p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440212014-01-03T03:19:54Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a>: Why do you think the second patch creates a performance problem?</p>
<p>Module#const_missing is an exceptional case. Am I missing something?</p>
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/390">@tmm1 (Aman Karmani)</a>: the stack tracking approach breaks down if the method id reported on return by ruby does not match the one reported on call; which I have seen happening in the past.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440462014-01-03T14:38:26Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>@tmm1's suspicion was right: c-return is also missing in the case when you try to call a nonexistent method.</p>
<p>It seems that c-return will be missing when raising an exception from C land.</p>
<p>Which means my patch doesn't really solve the underlying, more fundamental problem.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440732014-01-04T02:10:55Zdeivid (David Rodríguez)
<ul></ul><p>But when raising an exception from ruby, return events are emitted... Shouldn't this 2 cases be consistent?</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440972014-01-06T03:56:17Zdeivid (David Rodríguez)
<ul></ul><p>In byebug, the problem is I don't manually mantain the call stack, but only keep track of the stack size through the TracePoint API events. The only time I load the call stack is through the DebugInspector API right before the debugger stops in order to make it available to the user.</p>
<p>If I was to implement the solution suggested by <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/390">@tmm1 (Aman Karmani)</a>, how can I access the method_id for each frame from the C extension? Is the Thread::Backtrace::Locations API available to C extensions? Calling it through ruby for every c_return event will impact performance I guess...</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=440982014-01-06T05:51:19Ztmm1 (Aman Karmani)ruby@tmm1.net
<ul></ul><p>You can use rb_profile_frames() in 2.1, but it only reports ruby frames so it won't help identify C-call/return events.</p>
<p>You could also use TracePoint#method_id either from ruby or C, but @skaes reports the method ids sometimes don't match up. Maybe we can figure out why and fix it.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441132014-01-06T16:25:39Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>I have extended the patch to also cover method_missing, by changing a single cfp pointer manipulation to a call of rb_frame_pop().</p>
<p>See <a href="https://github.com/skaes/rvm-patchsets/blob/master/patches/ruby/2.1.0/head/railsexpress/05-fix-missing-c-return-event.patch#L121" class="external">https://github.com/skaes/rvm-patchsets/blob/master/patches/ruby/2.1.0/head/railsexpress/05-fix-missing-c-return-event.patch#L121</a></p>
<p>I have tested various other c functions raising exceptions. All of them work fine without the patches.</p>
<p>And my position is still that this is a ruby bug, which should be fixed instead of being worked around by all tool implementers.</p>
<p>The only thing stopping us from fixing it is @ko1's comment on performance impact, which I don't understand.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441142014-01-06T16:38:52Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>The patch isn't ideal yet: in case of const-missing, the c-return event is generated too early. I know how to fix this. Will upload a modified patch later.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441492014-01-07T17:04:54Zdeivid (David Rodríguez)
<ul></ul><p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/3497">@drkaes (Stefan Kaes)</a> If this only happens in certain c-methods it certainly looks like a bug. Thanks for working on this.</p>
<p>Thanks <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/390">@tmm1 (Aman Karmani)</a>, I guess I would have to store the method_id provided by the TracePoint API to be able to match it later.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441532014-01-07T18:23:18Zko1 (Koichi Sasada)
<ul></ul><p>(2014/01/03 3:19), drkaes (Stefan Kaes) wrote:</p>
<blockquote>
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a>: Why do you think the second patch creates a performance problem?</p>
<p>Module#const_missing is an exceptional case. Am I missing something?</p>
</blockquote>
<p>Sorry for my misunderstanding.</p>
<p>Let me clarify the spec.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="c1">###</span>
<span class="n">n</span> <span class="o">=</span> <span class="mi">0</span>
<span class="no">TracePoint</span><span class="p">.</span><span class="nf">new</span><span class="p">(){</span><span class="o">|</span><span class="n">tp</span><span class="o">|</span>
<span class="k">next</span> <span class="k">if</span> <span class="n">tp</span><span class="p">.</span><span class="nf">event</span> <span class="o">==</span> <span class="ss">:line</span>
<span class="k">case</span> <span class="n">tp</span><span class="p">.</span><span class="nf">event</span><span class="p">.</span><span class="nf">to_s</span>
<span class="k">when</span> <span class="sr">/call/</span>
<span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="s1">' '</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">n</span><span class="si">}#{</span><span class="n">tp</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span>
<span class="n">n</span><span class="o">+=</span><span class="mi">1</span>
<span class="k">when</span> <span class="sr">/return/</span>
<span class="n">n</span><span class="o">-=</span><span class="mi">1</span> <span class="k">if</span> <span class="n">n</span><span class="o">></span><span class="mi">0</span>
<span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="s1">' '</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">n</span><span class="si">}#{</span><span class="n">tp</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span>
<span class="k">else</span>
<span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="s1">' '</span> <span class="o">*</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">n</span><span class="si">}#{</span><span class="n">tp</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="p">}.</span><span class="nf">enable</span>
<span class="k">def</span> <span class="nf">f</span>
<span class="no">Object</span><span class="o">::</span><span class="no">XYZZY</span> <span class="c1">#=> const_missing</span>
<span class="k">end</span>
<span class="n">f</span>
<span class="cp">__END__
#=>
current behavior:
#<TracePoint:c_return `enable'@test.rb:15>
#<TracePoint:c_call `method_added'@test.rb:17>
#<TracePoint:c_return `method_added'@test.rb:17>
#<TracePoint:call `f'@test.rb:17>
#<TracePoint:c_call `const_missing'@test.rb:18>
#<TracePoint:c_call `initialize'@test.rb:18>
#<TracePoint:c_call `initialize'@test.rb:18>
#<TracePoint:c_return `initialize'@test.rb:18>
#<TracePoint:c_return `initialize'@test.rb:18>
#<TracePoint:c_call `exception'@test.rb:18>
#<TracePoint:c_return `exception'@test.rb:18>
#<TracePoint:c_call `backtrace'@test.rb:18>
#<TracePoint:c_return `backtrace'@test.rb:18>
#<TracePoint:raise@test.rb:18>
#<TracePoint:return `f'@test.rb:18>
expected behavior:
#<TracePoint:c_return `enable'@test.rb:15>
#<TracePoint:c_call `method_added'@test.rb:17>
#<TracePoint:c_return `method_added'@test.rb:17>
#<TracePoint:call `f'@test.rb:17>
#<TracePoint:c_call `const_missing'@test.rb:18>
#<TracePoint:c_return `const_missing'@test.rb:18> <-- NEW!
#<TracePoint:c_call `initialize'@test.rb:18>
#<TracePoint:c_call `initialize'@test.rb:18>
#<TracePoint:c_return `initialize'@test.rb:18>
#<TracePoint:c_return `initialize'@test.rb:18>
#<TracePoint:c_call `exception'@test.rb:18>
#<TracePoint:c_return `exception'@test.rb:18>
#<TracePoint:c_call `backtrace'@test.rb:18>
#<TracePoint:c_return `backtrace'@test.rb:18>
#<TracePoint:raise@test.rb:18>
#<TracePoint:return `f'@test.rb:18>
</span></code></pre>
<p>is it right?</p>
<p>This behavior is similar to "raise" behavior.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441542014-01-07T18:53:40Zko1 (Koichi Sasada)
<ul></ul><p>I modify the patch and all tests passes.<br>
<a href="http://www.atdot.net/sp/raw/6ny0zm" class="external">http://www.atdot.net/sp/raw/6ny0zm</a></p>
<p>If we can accept the spec of this behavior (order of tracing events), I<br>
will commit it.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441552014-01-07T20:06:43Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>The order of trace events is acceptable.</p>
<p>It's not ideal though: I think one would expect the events for creating the exception and attaching the backtrace to it to happen inside const_missing/method_missing.</p>
<p>But it seems to me this would require more complex code changes.</p>
<p>Thx a lot for fixing this.</p>
<p>Is it possible to backport this to 2.0 and 1.9.3?</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441562014-01-07T20:10:35Zdeivid (David Rodríguez)
<ul></ul><p>It sounds good to me. Any behavior with a balanced count of <code>call</code> and <code>return</code> events work.</p>
<p>Big thanks <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a>.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441572014-01-07T22:14:39Zdrkaes (Stefan Kaes)stkaes@googlemail.com
<ul></ul><p>Compiling with clang produces warnings:</p>
<p>in file included from ./include/ruby/ruby.h:1694:<br>
./include/ruby/intern.h:955:40: warning: unknown attribute 'warning' ignored [-Wattributes]<br>
void rb_frame_pop(void) <strong>attribute</strong>((warning("rb_frame_pop is obsolete. It will be deleted after Ruby 2.2.0.")));;</p>
<p>You probably need to change the method signature to:</p>
<p>DEPRECATED(void rb_frame_pop(void));</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=441892014-01-09T19:13:04Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r44535.<br>
Stefan, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.<br>
The patch base by drkaes (Stefan Kaes).<br>
[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: rb_mod_const_missing does not generate a c-return event (Closed)" href="https://bugs.ruby-lang.org/issues/9321">#9321</a>]</li>
<li>variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()<br>
instead of rb_frame_pop().</li>
<li>vm_eval.c (raise_method_missing): ditto.</li>
<li>vm_eval.c (rb_iterate): ditto.</li>
<li>internal.h (rb_vm_pop_cfunc_frame): add decl.</li>
<li>test/ruby/test_settracefunc.rb: add tests.<br>
provided by drkaes (Stefan Kaes).</li>
<li>vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):<br>
move definition of rb_frame_pop() and deprecate it.<br>
It doesn't care about `return' events.</li>
</ul> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460072014-03-30T16:32:55Zdeivid (David Rodríguez)
<ul></ul><p>Hi @koichi, I'm still running into this issue... :( I really don't know what's going on, because the tests pass in ruby's test suite, but the <code>c_return</code> event is not generated when I use the TracePoint API.</p>
<pre><code>require 'minitest/autorun'
class TestTracePoint < Minitest::Test
def test_method_missing
events = []
assert !respond_to?(:missing_method_59398)
TracePoint.new(:c_call, :c_return, :call, :return) { |tp|
events << [tp.event, tp.method_id] if tp.method_id == :method_missing
}.enable {
missing_method_59398 rescue nil
}
assert_equal([[:c_call, :method_missing], [:c_return, :method_missing]], events)
end
end
$ ruby --version
ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
$ ruby test_tracepoint.rb
Run options: --seed 31045
# Running:
F
Finished in 0.035420s, 28.2322 runs/s, 56.4645 assertions/s.
1) Failure:
TestTracePoint#test_method_missing [test_tracepoint.rb:12]:
--- expected
+++ actual
@@ -1 +1 @@
-[[:c_call, :method_missing], [:c_return, :method_missing]]
+[[:c_call, :method_missing]]
1 runs, 2 assertions, 1 failures, 0 errors, 0 skips
</code></pre>
<p>Also I have a couple of failing tests in byebug's test suite because of this. <a href="https://travis-ci.org/deivid-rodriguez/byebug/jobs/21874423" class="external">https://travis-ci.org/deivid-rodriguez/byebug/jobs/21874423</a></p>
<p>Thanks a lot.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460092014-03-30T22:38:34Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460182014-03-31T09:31:01Zko1 (Koichi Sasada)
<ul></ul><p>I check with test/unit (modified as follow) and I got no error. Do I miss anything?</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'test/unit'</span>
<span class="k">class</span> <span class="nc">TestTracePoint</span> <span class="o"><</span> <span class="no">Test</span><span class="o">::</span><span class="no">Unit</span><span class="o">::</span><span class="no">TestCase</span>
<span class="k">def</span> <span class="nf">test_method_missing</span>
<span class="n">events</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">assert</span> <span class="o">!</span><span class="nb">respond_to?</span><span class="p">(</span><span class="ss">:missing_method_59398</span><span class="p">)</span>
<span class="no">TracePoint</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:c_call</span><span class="p">,</span> <span class="ss">:c_return</span><span class="p">,</span> <span class="ss">:call</span><span class="p">,</span> <span class="ss">:return</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">tp</span><span class="o">|</span>
<span class="n">events</span> <span class="o"><<</span> <span class="p">[</span><span class="n">tp</span><span class="p">.</span><span class="nf">event</span><span class="p">,</span> <span class="n">tp</span><span class="p">.</span><span class="nf">method_id</span><span class="p">]</span> <span class="k">if</span> <span class="n">tp</span><span class="p">.</span><span class="nf">method_id</span> <span class="o">==</span> <span class="ss">:method_missing</span>
<span class="p">}.</span><span class="nf">enable</span> <span class="p">{</span>
<span class="n">missing_method_59398</span> <span class="k">rescue</span> <span class="kp">nil</span>
<span class="p">}</span>
<span class="n">assert_equal</span><span class="p">([[</span><span class="ss">:c_call</span><span class="p">,</span> <span class="ss">:method_missing</span><span class="p">],</span> <span class="p">[</span><span class="ss">:c_return</span><span class="p">,</span> <span class="ss">:method_missing</span><span class="p">]],</span> <span class="n">events</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>And I got</p>
<pre><code>1 tests, 2 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.2.0dev (2014-03-31 trunk 45486) [x86_64-linux]
</code></pre>
<p>Thanks,<br>
Koichi</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460202014-03-31T14:10:28Zdeivid (David Rodríguez)
<ul></ul><p>no no I was missing something.... :( I thought this bug fix was included in 2.1 but it's not. Last master works fine. I'm sorry for the confusion. And thanks a lot for having a look so quick!</p>
<p>Can I ask for this to be backported to 2.0 and 2.1?</p>
<p>Thanks!</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460262014-04-01T05:19:31Zko1 (Koichi Sasada)
<ul></ul><p>Ah, I see.</p>
<p>I think it should be backported, but it changes a behavior.</p>
<p>@naruse-san, can we backport it?</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460272014-04-01T06:07:17Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>Backport</strong> changed from <i>1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN</i> to <i>2.0.0: REQUIRED, 2.1: REQUIRED</i></li></ul><p>ささださん曰く、</p>
<blockquote>
<p>const_missing が呼ばれると、c_call は飛ばれるのに c_return が呼ばれない、ので、デバッガ作るときに困るので、<br>
c_return 呼ばれるようにした。<br>
これに依存した挙動は無いんじゃ無いかと思うのだが<br>
とのこと。<br>
具体的に結果がどう変わるかは<br>
<a href="https://bugs.ruby-lang.org/issues/9321#note-20" class="external">https://bugs.ruby-lang.org/issues/9321#note-20</a></p>
</blockquote> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460292014-04-01T06:13:14Zko1 (Koichi Sasada)
<ul></ul><p>This issues is available on 2.1 and 2.0.</p>
<p>This is possible that some applications implement workaround for this issue. This patch can breaks such applications. However, I'm not sure such applications exist (maybe don't exist).</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=460332014-04-01T11:45:49Zdeivid (David Rodríguez)
<ul></ul><p>As far as I'm concerned, this changes an (incorrect) behaviour and it should be backported. In byebug's case, having a balanced count of call and return events is critical and directly affects usability of the debugger. And when I thought of implementing a workaround inside byebug's didn't seem like an easy thing to do...</p>
<p>Stefan Kaes, did you implement a workaround for this in ruby-prof?</p>
<p>Cheers!</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=462142014-04-14T22:10:01Zko1 (Koichi Sasada)
<ul></ul><p>I vote to backport this ticket. I want to help them:<br>
<a href="https://github.com/deivid-rodriguez/byebug/issues/16#issuecomment-40421841" class="external">https://github.com/deivid-rodriguez/byebug/issues/16#issuecomment-40421841</a></p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=462432014-04-17T07:54:17Zdeivid (David Rodríguez)
<ul></ul><p>Thanks Koichi, appreciated. :)</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=471062014-06-09T13:05:56Zdeivid (David Rodríguez)
<ul></ul><p>Is there an official way to request a backport? Thanks!</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=472812014-06-19T06:08:16Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul></ul><p>I agree that this should be backported to 2.1 branch.<br>
Is there any opposite opinion?</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=473582014-06-23T22:43:45Zdeivid (David Rodríguez)
<ul></ul><p>Thanks for following up Tomoyuki!</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=474422014-06-29T16:13:45Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.0.0: REQUIRED, 2.1: REQUIRED</i> to <i>2.0.0: REQUIRED, 2.1: DONE</i></li></ul><p>Backported into <code>ruby_2_1</code> branch at r46608.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=475852014-07-03T06:21:05Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>backported into <code>ruby_2_0_0</code> at r46671.</p> Ruby master - Bug #9321: rb_mod_const_missing does not generate a c-return eventhttps://bugs.ruby-lang.org/issues/9321?journal_id=475862014-07-03T06:25:13Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.0.0: REQUIRED, 2.1: DONE</i> to <i>2.0.0: DONE, 2.1: DONE</i></li></ul>