thread dump?

Discussion in 'Ruby' started by cs5b@yahoo.com, Oct 22, 2006.

  1. Guest

    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
    , Oct 22, 2006
    #1
    1. Advertising

  2. 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
    Joel VanderWerf, Oct 22, 2006
    #2
    1. Advertising

  3. Eric Hodel Guest

    On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:
    > 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

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

    http://trackmap.robotcoop.com
    Eric Hodel, Nov 15, 2006
    #3
  4. Eric Hodel wrote:
    > On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:
    >> 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

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
    Joel VanderWerf, Nov 16, 2006
    #4
  5. Eric Hodel Guest

    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.


    Ooh, right, my bad.

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

    http://trackmap.robotcoop.com
    Eric Hodel, Nov 16, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frank van der Borden

    Thread dump question

    Frank van der Borden, Sep 9, 2003, in forum: Java
    Replies:
    0
    Views:
    758
    Frank van der Borden
    Sep 9, 2003
  2. tracy
    Replies:
    2
    Views:
    16,893
  3. kazuya imabayashi

    Thread dump for Java plugin

    kazuya imabayashi, Apr 5, 2005, in forum: Java
    Replies:
    2
    Views:
    1,470
  4. Meeaz

    Full Thread Dump

    Meeaz, May 4, 2005, in forum: Java
    Replies:
    1
    Views:
    3,629
  5. halfdog
    Replies:
    12
    Views:
    12,395
Loading...

Share This Page