用于调试的工具在java应用程序中挂起 [英] Tool for debugging hangs in java application
问题描述
我有一个java应用程序,有一半时间只是挂起,而另一半JVM崩溃了。有没有一个工具我可以用来看看是什么让它挂起和/或崩溃?
我正在使用CentOS 5.6
I've got a java application that half the time just hangs, and the other half the JVM crashes. Is there a tool I can use to see what's going on that makes it hang and/or crash? I'm using CentOS 5.6
推荐答案
有两种不同的情况。
应用程序崩溃:
这是一个OOM吗? NPE?有什么例外?如果有jvm崩溃,你会看到hs_err_.log( http:// java。 sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf )
查看文件,您可能会看到自己的JNI是否导致崩溃或JVM错误。
Looking at the file you may see if your own JNI caused a crash or JVM bug.
应用程序挂起:我将从visualvm或jstat开始(两者都是JDK的一部分)。你可以看到线程的当前状态并检查是否有任何应用程序错误..
Application Hang: I would start with visualvm or jstat (both are part of JDK). You can see current state of threads and check if there is any application error..
其他linux工具可以帮助查看内部进程:
Other linux tools that could help to see inside process:
- lsof : you can check if the process opened too many files
- strace: see current activity from system call point of view.
Oracle工具文档提供了非常整洁的列表。它还链接了特定于操作系统的工具
Oracle tools documentation provides pretty neat listing. It also links Operating System Specific tools
这篇关于用于调试的工具在java应用程序中挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!