Project

General

Profile

Actions

Bug #19382

closed

Infinite loop in tracepoints when calling `pp`

Added by luke-gru (Luke Gruber) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:112057]

Description

events = []
meth_name = "mymethod"
code = <<~RUBY
    def #{meth_name}(); true; end
RUBY
eval(code, binding, 'my_location')
tracepoint = TracePoint.new(:line) { |tp|
  events << tp.path # infinite loop here
}.tap(&:enable)

send("#{meth_name}")
pp events

Updated by luke-gru (Luke Gruber) about 1 year ago

  • Tracker changed from Bug to Misc
  • Subject changed from Infinite loop in tracepoints where called method comes from evaled code to (please close) Infinite loop in tracepoints when calling `pp`
  • Backport deleted (2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN)

Nevermind, this is a weird case that using pp traverses the events and it calls methods which hook into the tracepoint, which appends to the list, and then pp does the same all over again.
Just a recursive bug in my code, not in Ruby itself.

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

  • Tracker changed from Misc to Bug
  • Subject changed from (please close) Infinite loop in tracepoints when calling `pp` to Infinite loop in tracepoints when calling `pp`
  • Status changed from Open to Closed
  • Backport set to 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN

@luke-gru (Luke Gruber) Please don't update subject and category and more. We can close it only your request comment.

Actions

Also available in: Atom PDF

Like0
Like0Like0