Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See stacktrace after deadlock

My application is being executed in debug mode and then deadlock happens. Is there any way to see the stacktrace before deadlock or at least the last called method?

like image 499
SiberianGuy Avatar asked May 18 '11 12:05

SiberianGuy


People also ask

How do you see Stacktrace?

You can obtain a stack trace from a thread – by calling the getStackTrace method on that Thread instance. This invocation returns an array of StackTraceElement, from which details about stack frames of the thread can be extracted.

How do I activate Stacktrace?

This might be the easiest way to add the Stacktrace option in Android Studio, simply navigate to the files option and then you can add Stacktrace in place of command-line options and you are good to go.

How do you trace a thread in Java?

In the previous java versions, we can use Throwable::getStackTrace, Thread::getStackTrace, and SecurityManager:: GetClassContext provided methods to obtain the thread stack. Thread. getStackTrace() method will return an array of stack trace elements representing the stack dump of a thread (StackTraceElement[]).

How does Stacktrace work?

A stack trace shows the call stack (sets of active stack frames) and provides information on the methods that your code called. Usually, a stack trace is shown when an Exception is not handled correctly in code. (An exception is what a runtime environment uses to tell you that there's an error in your code.)


1 Answers

Click BreakAll (Ctrl + Alt + Break) and open Debug->Windows->Threads

There you can see stacktrace for every thread

like image 130
Stecya Avatar answered Oct 07 '22 00:10

Stecya