Project

General

Profile

Actions

Bug #14865

closed

Raising exception in c_return event hook causes infinite loop

Added by ktsj (Kazuki Tsujimoto) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-06-23) [x86_64-linux]
[ruby-dev:50582]

Description

c_returnのイベントフックの中で例外を起こすと無限ループになるケースがあります。
例外発生時にフレームがポップされずスタックに残り続けてしまうのが原因です。

$ cat t.rb
TracePoint.new(:c_return){|tp|
  p tp.method_id
  raise
}.enable{
  tap{ itself }
}
$ ruby t.rb
:itself
:tap
:tap
(snip)
Actions #1

Updated by ktsj (Kazuki Tsujimoto) almost 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63727.


vm.c: fix infinite loop

  • vm.c: use EXEC_EVENT_HOOK_AND_POP_FRAME. While exception handling, if an exception
    is raised in hooks, need to pop current frame and raise this raised exception by hook.

[ruby-dev:50582] [Bug #14865]

Updated by usa (Usaku NAKAMURA) over 5 years ago

  • Backport changed from 2.3: WONTFIX, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: WONTFIX, 2.4: DONE, 2.5: REQUIRED

ruby_2_4 r64129 merged revision(s) 63727.

Updated by nagachika (Tomoyuki Chikanaga) over 5 years ago

  • Backport changed from 2.3: WONTFIX, 2.4: DONE, 2.5: REQUIRED to 2.3: WONTFIX, 2.4: DONE, 2.5: DONE

ruby_2_5 r64438 merged revision(s) 63727.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0