[ruby-core:112057] [Ruby master Bug#19382] Infinite loop in tracepoints where called method comes from evaled code

Issue #19382 has been reported by luke-gru (Luke Gruber). ---------------------------------------- Bug #19382: Infinite loop in tracepoints where called method comes from evaled code https://bugs.ruby-lang.org/issues/19382 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19382 has been updated by luke-gru (Luke Gruber). 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. ---------------------------------------- Misc #19382: (please close) Infinite loop in tracepoints when calling `pp` https://bugs.ruby-lang.org/issues/19382#change-101494 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/

Issue #19382 has been updated by hsbt (Hiroshi SHIBATA). 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 Please don't update subject and category and more. We can close it only your request comment. ---------------------------------------- Bug #19382: Infinite loop in tracepoints when calling `pp` https://bugs.ruby-lang.org/issues/19382#change-101495 * Author: luke-gru (Luke Gruber) * Status: Closed * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- ```ruby 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 ``` -- https://bugs.ruby-lang.org/
participants (2)
-
hsbt (Hiroshi SHIBATA)
-
luke-gru (Luke Gruber)