Thread dump?

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

cs5b@yahoo.com 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.

···

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

$ 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

···

On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:

cs5b@yahoo.com 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.

--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Eric Hodel 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.

$ 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

···

On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:

cs5b@yahoo.com wrote:

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Ooh, right, my bad.

···

On Nov 15, 2006, at 5:13 PM, Joel VanderWerf wrote:

Eric Hodel 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: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.

--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com