From: "garysweaver (Gary Weaver)" Date: 2012-10-18T02:49:46+09:00 Subject: [ruby-core:48056] [ruby-trunk - Bug #7180] set_trace_func with error in proc block locks up Ruby with 100% cpu usage and no way to exit without killing proc Issue #7180 has been updated by garysweaver (Gary Weaver). Workaround to help avoid runtime syntax errors, etc. causing issues I guess is to rescue Exception, though maybe there is a better way. l = lambda {|event, file, line, id, binding, classname| eval "def invalid syntax"} set_trace_func proc {|event, file, line, id, binding, classname| begin;l.call(event, file, line, id, binding, classname);rescue Exception => e;puts e;end} (Note: in irb you have to ignore the output and just type exit and return, because every keystroke causes a puts.) Might want to add something in the rdoc for that method to indicate that it doesn't handle errors well. ---------------------------------------- Bug #7180: set_trace_func with error in proc block locks up Ruby with 100% cpu usage and no way to exit without killing proc https://bugs.ruby-lang.org/issues/7180#change-30978 Author: garysweaver (Gary Weaver) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] Causes 100% cpu usage and cannot ctrl-C to exit (have to kill proc): set_trace_func proc {|event, file, line, id, binding, classname| raise "error"} Understand that set_trace_func plays by different rules, but this isn't expected. -- http://bugs.ruby-lang.org/