如何分析来自 Java 核心转储的信息?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/951095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 21:29:01  来源:igfitidea点击:

How to analyze information from a Java core dump?

javaanalysiscoredump

提问by

If a process crashes and leaves a core dump or I create one with gcorethen how can I analyze it?

如果进程崩溃并留下核心转储,或者我创建了一个核心转储,gcore那么我该如何分析它?

I'd like to be able to use jmap, jstack, jstatetc and also to see values of all variables.

我希望能够使用jmapjstackjstat等也看到所有变量的值。

This way I can find the reasons for a crashed or frozen JVM.

通过这种方式,我可以找到 JVM 崩溃或冻结的原因。

回答by Karl

IBM provide a number of tools which can be used on the sun jvm as well. Take a look at some of the projects on alphaworks, they provide a heap and thread dump analyzers

IBM 提供了许多也可以在 sun jvm 上使用的工具。看看 alphaworks 上的一些项目,它们提供了堆和线程转储分析器

Karl

卡尔

回答by brianmarco

Maybe VisualVM can help (haven't yet had a chance to try it myself). Link:

也许 VisualVM 可以提供帮助(还没有机会自己尝试)。关联:

http://java.sun.com/javase/6/docs/technotes/guides/visualvm/coredumps.html

http://java.sun.com/javase/6/docs/technotes/guides/visualvm/coredumps.html

回答by Santosh Gokak

I recommend you to try Netbeans Profiler.It has rich set of tools for real time analysis. Tools from IbM are worth a try for offline analysis

我建议您尝试使用Netbeans Profiler。它具有丰富的实时分析工具集。IbM 的离线分析工具值得一试

回答by skaffman

Are you sure a core dump is what you want here? That will contain the raw guts of the running JVM, rather than java-level information. Perhaps a JVM heap dump is more what you need.

您确定您想要的是核心转储吗?这将包含正在运行的 JVM 的原始内容,而不是 Java 级别的信息。也许 JVM 堆转储更符合您的需求。

回答by chillitom

Okay if you've created the core dump with gcore or gdb then you'll need to convert it to something called a HPROFfile. These can be used by VisualVM, Netbeans or Eclipse's Memory Analyzer Tool (formerly SAP Memory Analyzer). I'd recommend Eclipse MAT.

好的,如果您已经使用 gcore 或 gdb 创建了核心转储,那么您需要将其转换为HPROF文件。这些可以由 VisualVM、Netbeans 或 Eclipse 的内存分析器工具(以前称为 SAP 内存分析器)使用。我推荐Eclipse MAT。

To convert the file use the commandline tool jmap.

要转换文件,请使用命令行工具jmap

# jmap -dump:format=b,file=dump.hprof /usr/bin/java core.1234

where:

在哪里:

dump.hprofis the name of the hprof file you wish to create

dump.hprof是您要创建的 hprof 文件的名称

/usr/bin/java is the path to the version of the java binary that generated the core dump

/usr/bin/java 是生成核心转储的 java 二进制文件版本的路径

core.1234 is your regular core file.

core.1234 是您的常规核心文件。

回答by JB-

Actually, VisualVM can process application core dump.

实际上,VisualVM 可以处理应用程序核心转储。

Just invoke "File/Add VM Coredump" and will add a new application in the application explorer. You can then take thread dump or heap dump of that JVM.

只需调用“File/Add VM Coredump”,就会在应用程序资源管理器中添加一个新应用程序。然后,您可以获取该 JVM 的线程转储或堆转储。

回答by Axel

Try the lady4j stack analyzer, it could help you:

试试lady4j堆栈分析器,它可以帮助你:

http://www.lady4j.com/solveStack.jsp

http://www.lady4j.com/solveStack.jsp

回答by Emil

jhat is one of the best i have used so far.To take a core dump,I think you better use jmap and jps instead of gcore(i haven't used it).Check the link to see how to use jhat. http://www.lshift.net/blog/2006/03/08/java-memory-profiling-with-jmap-and-jhat

jhat 是迄今为止我用过的最好的之一。要进行核心转储,我认为您最好使用 jmap 和 jps 而不是 gcore(我还没有使用过它)。检查链接以了解如何使用 jhat。 http://www.lshift.net/blog/2006/03/08/java-memory-profiling-with-jmap-and-jhat

回答by Dave Pacheco

See http://www.oracle.com/technetwork/java/javase/tsg-vm-149989.pdf. You can use "jdb" directly on the core file.

请参阅http://www.oracle.com/technetwork/java/javase/tsg-vm-149989.pdf。您可以直接在核心文件上使用“jdb”。

回答by cmd

If you are using an IBM JVM, downloadthe IBM Thread and Monitor Dump Analyzer. It is an excellent tool. It provides thread detail and can point out deadlocks, etc. The following blog postprovides a nice overview on how to use it.

如果您使用的是IBM JVM下载IBM线程和监视器转储分析器。它是一个很好的工具。它提供线程详细信息并可以指出死锁等。以下博客文章提供了有关如何使用它的很好的概述。