杀死-3返回空
我有一个java应用程序,它似乎被卡住了。我尝试了kill -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
...
编辑2:
这是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:第 539 行:18217 中止“/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-modu les.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/plat形式/lib/org-openide-util.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/boot_ja.jar:/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.ja r:/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/locale/org-openide-util-lookup_ja.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org-openide-util-lo okup_zh_CN.jar:/usr/pkgs/java/1.6.0.25/lib/visualvm/platform/lib/locale/org-openide-util_ja.jar:/usr/pkgs/java/1.6.0.25/lib/vi sualvm/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//探查器:“-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<& ;0
I have a java application, that seems to be stuck. I tried kill -3 but the output is empty (it is redirected to file but nothing is there).
what way can I see what it is doing?
EDIT:
I tried jstack but it crashed:
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:
this is jvisualvm crash:
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.jar:/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/platform/lib/locale/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/visualvm/platform/lib/locale/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<&0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试VisuamVM,你可以在每个版本 6 之后的 JDK 位于
jdkInstallDir/bin/visualvm
。Try VisuamVM, you can find it in every JDK after version 6 at
jdkInstallDir/bin/visualvm
.我认为你不走运。有时,应用程序会进入死状态,无法通过任何东西(kill、jstack 或 jvisualvm)进行线程转储。
如果这种情况经常发生,则设置一个计划线程转储并可能设置 jmap -histo:live。您需要在应用程序变得无响应之前收集线程和内存转储。与文本文件相比,我更喜欢转储,因为您可以让脚本每半小时运行一次,不需要显示,并且可以通过 grep 等工具轻松处理。 Jvisualvm 非常适合查找内存泄漏的根本原因,但首先要确定您是否有内存泄漏,因为它会给您的应用程序带来压力并导致崩溃。
I think you are out of luck. Sometimes an application goes into a dead state that cannot be thread dumped by anything, kill, jstack or jvisualvm.
If this is happening regularly, then setup a schedule thread dump and possibly jmap -histo:live. You need to gather thread and memory dumps before the application becomes unresponsive. I prefer dumps to text files because you can leave a script running overnight running every half hour, doesn't require a display and can be easily processed by things like grep. Jvisualvm is great for finding the root cause of memory leaks, but first determine you have one, as it can stress your application out and cause a crash.
使用
kill -3
执行转储不会在该命令的标准输出上输出线程转储,而是在 java 进程的标准输出上输出它。Performing a dump with
kill -3 <PID>
doesn't output the thread dump on the stdout of that command, it outputs it on the stdout of the java process.