我有一个java应用程序,似乎卡住了。我试过杀-3但输出是空的(它被重定向到文件,但没有任何东西) 我怎样才能看到它在做什么?
编辑:
我尝试了jstack,但它崩溃了:
Linux # /usr/pkgs/java/1.6.0.25/bin/jstack -F -l 12666
Attaching to process ID 12666, please wait...
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0xaf121777, pid=5423, tid=2937191328
JRE version: 6.0_25-b06
Java VM: Java HotSpot(TM) Server VM (20.0-b11 mixed mode linux-x86 )
Problematic frame:
C [libsaproc.so+0x1777] void+0x1777
...
EDIT2:
这是jvisualvm崩溃:
Linux # /usr/pkgs/java/1.6.0.25/bin/jvisualvm
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0xf36d0777, pid=18217, tid=4090493856
JRE version: 6.0_25-b06
Java VM: Java HotSpot(TM) Client VM (20.0-b11 mixed mode, sharing linux-x86 )
Problematic frame:
C [libsaproc.so+0x1777] void+0x1777
An error report file with more information is saved as:
/tmp/root/feeder_wa/coho_idc/logs/hs_err_pid18217.log
If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
/usr/pkgs/java/1.6.0.25/bin /../ lib / visualvm // platform / lib / nbexec:line 539:18217 Aborted“/usr/pkgs/java/1.6.0.25/bin/java “-Djdk.home =”/ usr / pkgs / java / 1.6.0.25“-classpath”/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/boot.jar:/usr/pkgs/java /1.6.0.25/lib/visualvm/platform/lib/org-openide-modules.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/org-openide-util-lookup.jar: /usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/org-openide-util.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/boot_ja。罐子:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/boot_zh_CN.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org- openide-modules_ja.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org-openide-modules_zh_CN.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/平台/ lib中/区域/ ORG-openide-UTIL-lookup_ja.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:在/ usr / PKGS / JAVA / 1.6.0.25 / LIB /视觉VM /平台/ lib中/区域/ ORG-openide-util_ja.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org-openide-util_zh_CN.jar:在/ usr / PKGS / java / 1.6.0.25 / lib / dt.jar:/usr/pkgs/java/1.6.0.25/lib/tools.jar“-Dnetbeans.dirs =”/ usr / pkgs / java / 1.6.0.25 / bin / .. /lib/visualvm//visualvm:/usr/pkgs/java/1.6.0.25/bin/../lib/visualvm//profiler:“ - Dnetbeans.home =”/ usr / pkgs / java / 1.6.0.25 / lib / visualvm / platform“'-client''-Xms24m''-Xmx256m''-Dsun.jvmstat.perdata.syncWaitMs = 10000''Dsun.java2d.noddraw = true''Dsun.java2d.d3d = false' - XX:+ HeapDumpOnOutOfMemoryError -XX:HeapDumpPath =“/ root / .visualvm / 6u23 / var / log / heapdump.hprof”org.netbeans.Main --userdir“/root/.visualvm/6u23”“ - branding”“visualvm “0 <&lt;&lt; 0&lt;&lt; 0&gt;
答案 0 :(得分:2)
尝试VisuamVM,您可以在jdkInstallDir/bin/visualvm
版本6之后的每个JDK中找到它。
答案 1 :(得分:1)
我觉得你运气不好。有时应用程序进入死状态,不能被任何东西,kill,jstack或jvisualvm线程转储。
如果这种情况经常发生,那么设置一个调度线程转储,可能还有jmap -histo:live。您需要在应用程序无响应之前收集线程和内存转储。我更喜欢转储到文本文件,因为你可以让脚本每隔半小时运行一夜,不需要显示,并且可以通过像grep这样的东西轻松处理。 Jvisualvm非常适合查找内存泄漏的根本原因,但首先确定您有一个,因为它可能会压缩您的应用程序并导致崩溃。