How to troubleshoot a Java application / process on Linux

Say that your application is not responding, and you cannot connect a debugger to it, since it rejects everything. All you have is Linux Bash and the process id. How would you investigate the problem? What tools would you use? My goal is to improve troubleshooting skills with Java.

This specific issue that we had in production was on the customer’s website.

+3
source share
6 answers

You can take a stream dump from the application by issuing:

kill -3 

, , . , , , - , . . .

http://manikandakumar.blogspot.com/2006/12/reading-thread-dumps.html

jstack, JDK - , .

http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/jstack.html

+4

, kill -3 . Thread Dump Analyzer, .

, top. , ? , jmap / . , -F, , , jmap Java-. , Eclipse Memory Analyzer, .

, - . , , .

+1
jstack <pid>
0

. jconsole, , .

0

Java 6, Visualvm (https://visualvm.dev.java.net/), JDK , MemoryDump ( ) VM Process. VisualVM Eclipse MAT- ( http://www.eclipse.org/mat/).

, ..

- .

0

I agree with others that Thread dumps are the way to go. I would like to add that you should get a lot of thread dumps. You can make very simple profiling with just a few unix commands. Check out my post here.

0
source

Source: https://habr.com/ru/post/1707574/


All Articles