Forum: Ruby-core [ruby-trunk - Bug #7180][Open] set_trace_func with error in proc block locks up Ruby with 100% cpu u

Posted by Gary Weaver (garysweaver)
on 2012-10-17 19:35
(Received via mailing list)
Issue #7180 has been reported by garysweaver (Gary Weaver).

----------------------------------------
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

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.
Posted by Gary Weaver (garysweaver)
on 2012-10-17 19:50
(Received via mailing list)
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.
Posted by drbrain (Eric Hodel) (Guest)
on 2012-10-18 02:37
(Received via mailing list)
Issue #7180 has been updated by drbrain (Eric Hodel).

Category set to core
Status changed from Open to Feedback

=begin
I can't reproduce this.  Can you provide a way to reproduce it?

With trunk:

  $ time ruby20 -ve 'set_trace_func proc {|event, file, line, id, 
binding, classname| raise "error"}; loop do 1 + 1 end'
  ruby 2.0.0dev (2012-09-06 trunk 36915) [x86_64-darwin12.1.0]
  -e:1:in `block in <main>': error (RuntimeError)
    from -e:1:in `<main>'

  real  0m0.017s
  user  0m0.012s
  sys  0m0.004s

With ruby 1.9.4-p194 as you are running:

  $ time ruby19 -ve 'set_trace_func proc {|event, file, line, id, 
binding, classname| raise "error"}; loop do 1 + 1 end'
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
  -e:1:in `block in <main>': error (RuntimeError)
    from -e:1:in `<main>'

  real  0m0.017s
  user  0m0.012s
  sys  0m0.004s

=end

----------------------------------------
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-30988

Author: garysweaver (Gary Weaver)
Status: Feedback
Priority: Normal
Assignee:
Category: core
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.
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-05 13:52
(Received via mailing list)
Issue #7180 has been updated by mame (Yusuke Endoh).

Target version set to 2.0.0

Gary Weaver, ping?

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
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-32407

Author: garysweaver (Gary Weaver)
Status: Feedback
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
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.
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-07 16:37
(Received via mailing list)
Issue #7180 has been updated by mame (Yusuke Endoh).

Priority changed from Normal to Low


----------------------------------------
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-32571

Author: garysweaver (Gary Weaver)
Status: Feedback
Priority: Low
Assignee:
Category: core
Target version: 2.0.0
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.
Posted by ko1 (Koichi Sasada) (Guest)
on 2012-11-25 16:20
(Received via mailing list)
Issue #7180 has been updated by ko1 (Koichi Sasada).


The following script also repeat "[:return, 1]".
I'm not sure it is same problem or not.

def m
  p:m
end

TracePoint.trace(:call, :return){|tp| p [tp.event, tp.line]; raise 
"bar"}
m

----------------------------------------
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-33861

Author: garysweaver (Gary Weaver)
Status: Feedback
Priority: Low
Assignee:
Category: core
Target version: 2.0.0
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.
Posted by charliesome (Charlie Somerville) (Guest)
on 2012-11-27 14:53
(Received via mailing list)
Issue #7180 has been updated by charliesome (Charlie Somerville).


This can be reproduced inside eval:

    eval 'set_trace_func proc {|event, file, line, id, binding, 
classname| raise "error"}'
----------------------------------------
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-34042

Author: garysweaver (Gary Weaver)
Status: Feedback
Priority: Low
Assignee:
Category: core
Target version: 2.0.0
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.
Posted by ko1 (Koichi Sasada) (Guest)
on 2012-12-21 12:30
(Received via mailing list)
Issue #7180 has been updated by ko1 (Koichi Sasada).

Status changed from Feedback to Closed
Assignee set to ko1 (Koichi Sasada)

Maybe r38331 (nobu's commit) solves this issue.

----------------------------------------
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-34932

Author: garysweaver (Gary Weaver)
Status: Closed
Priority: Low
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.