thread dump?

C

cs5b

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
 
J

Joel VanderWerf

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

Eric Hodel

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.

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

Joel VanderWerf

Eric said:
$ 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
 
E

Eric Hodel

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.

Ooh, right, my bad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top