Retrieve callstack from a Thread

Discussion in 'Java' started by Morten Simonsen, Sep 17, 2003.

  1. Hi

    I want to retrieve the callstack from a Thread which is running, but for
    some reason has gone
    into "hang-mode" (usually waiting for some I/O). The reason for this is that
    I have to
    terminate this Thread, but I would like to know in which method the Thread
    got stuck, so
    that I can check this "problem area".

    So far I have only managed to produce a callstack if I throw an exception
    and manipulate
    Throwable's printStackTrace()-method. This cannot be done if the Thread is
    stuck and it
    will not do to use this method for every step in the Thread and preserve the
    results because
    of its enormous performance impact.

    So is there any other way? Or is this kind of information hidden away?

    Morten Simonsen
    Morten Simonsen, Sep 17, 2003
    #1
    1. Advertising

  2. Morten Simonsen () wrote:
    : I want to retrieve the callstack from a Thread which is running, but for
    : some reason has gone
    : ....
    : So is there any other way? Or is this kind of information hidden away?

    Well any good debugger should be able to do it. Some profilers may be
    able to do it, I know that my profiler, jmp(1), can show all threads
    and the current stack for each thread, including the object they are
    waiting on (if any).

    jmp can be found at:
    http://www.khelekore.org/jmp/

    /robo
    Robert Olofsson, Sep 17, 2003
    #2
    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. Charles A. Lackman

    Terminating a thread from the main thread

    Charles A. Lackman, Dec 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,532
    Herfried K. Wagner [MVP]
    Dec 9, 2004
  2. Jacob

    Callstack question

    Jacob, Sep 22, 2003, in forum: Java
    Replies:
    0
    Views:
    340
    Jacob
    Sep 22, 2003
  3. Replies:
    11
    Views:
    515
    Ian Collins
    Apr 26, 2006
  4. callstack level

    , Jul 5, 2006, in forum: Ruby
    Replies:
    3
    Views:
    100
    Robert Klemme
    Jul 6, 2006
  5. Replies:
    1
    Views:
    182
Loading...

Share This Page