Getting a thread-dump

Discussion in 'Ruby' started by Matt Mower, Jan 1, 2005.

  1. Matt Mower

    Matt Mower Guest

    Hi folks,

    Is there a way I can get the Ruby interpreter to dump a stack trace
    for all running threads? I have some code hang during I/O and I want
    to see the callstack when it does.

    On Windows the Java interpreter will do something like this when you
    hit ctrl+break. I'm using the 1.8.2-final one-click installer on
    Windows XP.

    Thanks,

    Matt

    --
    Matt Mower :: http://matt.blogs.it/
    Matt Mower, Jan 1, 2005
    #1
    1. Advertising

  2. "Matt Mower" <> schrieb im Newsbeitrag
    news:...
    > Hi folks,
    >
    > Is there a way I can get the Ruby interpreter to dump a stack trace
    > for all running threads? I have some code hang during I/O and I want
    > to see the callstack when it does.
    >
    > On Windows the Java interpreter will do something like this when you
    > hit ctrl+break. I'm using the 1.8.2-final one-click installer on
    > Windows XP.


    I don't know such a thing (you're probably thinking of JVM's Ctrl-C).
    However, there are some options: One thing you could do is set
    Thread.abort_on_exception = true - maybe your thread dies silently from an
    uncaught exception. Or you wrap all threads in "begin ... rescue Exception
    => e; puts e.backtrace end" if you have access to the code.

    Third option would be to trace execution via set_trace_func and record calls
    and returns in a file (or to console if that doesn't clutter too much). But
    this is likely to be slow unless you can narrow it down to a certain class
    or instance.

    Kind regards

    robert
    Robert Klemme, Jan 1, 2005
    #2
    1. Advertising

  3. Hello Matt,

    MM> Hi folks,

    MM> Is there a way I can get the Ruby interpreter to dump a stack trace
    MM> for all running threads? I have some code hang during I/O and I want
    MM> to see the callstack when it does.

    You can do this with Arachno Ruby.

    Use the "Stop all threads" command from the debug menu and then use the debugger
    state window to view all stack frames.



    --
    Best regards, emailto: scholz at scriptolutions dot com
    Lothar Scholz http://www.ruby-ide.com
    CTO Scriptolutions Ruby, PHP, Python IDE 's
    Lothar Scholz, Jan 1, 2005
    #3
    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:
    759
    Frank van der Borden
    Sep 9, 2003
  2. tracy
    Replies:
    2
    Views:
    16,901
  3. kazuya imabayashi

    Thread dump for Java plugin

    kazuya imabayashi, Apr 5, 2005, in forum: Java
    Replies:
    2
    Views:
    1,472
  4. halfdog
    Replies:
    12
    Views:
    12,411
  5. Orson

    getting thread dump

    Orson, Jul 30, 2008, in forum: Java
    Replies:
    0
    Views:
    537
    Orson
    Jul 30, 2008
Loading...

Share This Page