Hi there, I have a process that seems to be stuck somewhere. Is there
the possibility of doing a thread dump to show where it is hanging on?
Cheers -
Christian
[email protected] wrote:
Hi there, I have a process that seems to be stuck somewhere. Is there
the possibility of doing a thread dump to show where it is hanging on?
Cheers -
Christian
Not in general, without a Thread#backtrace method. I’ve asked for it…
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/159482
As noted in that post, you can destructively find out where the thread
is by calling #raise on it. Just make sure the thread has an exception
handler somewhere to print out the exception and backtrace.
On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/159482
As noted in that post, you can destructively find out where the
thread is by calling #raise on it. Just make sure the thread has an
exception handler somewhere to print out the exception and backtrace.
$ ruby -e ‘t = Thread.start do sleep end; t.raise “hi”; t.value’
-e:1: hi (RuntimeError)
from -e:1:in `value’
from -e:1
–
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
On Nov 15, 2006, at 5:13 PM, Joel VanderWerf wrote:
Eric H. wrote:
$ ruby -e ‘t = Thread.start do sleep end; t.raise “hi”; t.value’
-e:1: hi (RuntimeError)
from -e:1:in `value’
from -e:1That doesn’t tell you what line of code the thread is sleeping on,
only what lines of code #raise and #value are called on. You lose
the whole backtrace, in fact.
Ooh, right, my bad.
–
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
Eric H. wrote:
As noted in that post, you can destructively find out where the thread
is by calling #raise on it. Just make sure the thread has an exception
handler somewhere to print out the exception and backtrace.$ ruby -e ‘t = Thread.start do sleep end; t.raise “hi”; t.value’
-e:1: hi (RuntimeError)
from -e:1:in `value’
from -e:1
That doesn’t tell you what line of code the thread is sleeping on, only
what lines of code #raise and #value are called on. You lose the whole
backtrace, in fact.
$ cat th.rb
t = Thread.start do
sleep
end
t.raise “hi”
t.value
$ ruby th.rb
th.rb:5: hi (RuntimeError)
from th.rb:6:in `value’
from th.rb:6