Bug #15578
Updated by zetter (Chris Zetter) almost 6 years ago
Hello, I've been using TracePoint on a Ruby on Rails project and noticed that the number of method 'return' events was less than the number of 'call' events. An example of a return event that isn't always logged (depending on inputs) is the `_decrypt` method - https://github.com/rails/rails/blob/v5.2.2/activesupport/lib/active_support/message_encryptor.rb#L183 "_decrypt method":https://github.com/rails/rails/blob/v5.2.2/activesupport/lib/active_support/message_encryptor.rb#L183 based off of this I've made a simplified example based on this method. example. There are other methods that don't have exact same structure but show the same problem. I haven't yet been able to make reproducible examples for them. Running the following code with TracePoint doesn't emit the 'return' event as expected: ``` ruby def example 1 if 1 == 1 rescue end example() ``` Here are the events that are logged using TracePoint: ``` [nil, :line] [:example, :call] [:example, :line] ``` I expect it log the return even from the example method: ``` [nil, :line] [:example, :call] [:example, :line] [:example, :return] ``` I have attached a runnable example. This bug looks like it was introduced between 2.5.3 and 2.6.0. It works as expected on 2.5.3, and is occurs on 2.6.0 and 2.6.1 I've also tried compiling the instructions without peephole optimisation on and the bug no longer occurs.