如何理解Java热点错误
伙计们,当 JVM 崩溃时,它会写入错误日志 hs_err_pid.log。 我想找出导致 JVM 崩溃的原因? 如何理解这些Log,是否在任何地方都记录了这个Log是如何安排的。 我尝试在网上搜索但无济于事:-(
指出相关的 URL 将不胜感激。谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除非您调用本机代码 (JNI),否则代码中的任何内容都不应该导致 JVM 崩溃; 因此该日志文件中的堆栈跟踪信息对于大多数开发人员来说可能并不是很有用。 这可能就是为什么它可能没有被记录(至少在外部)。
因此,最好的办法可能是按照错误消息的建议提交错误报告。
此演示文稿包含崩溃文件的详细说明,其中包含一组示例以便您可以练习。
Unless you are calling native code (JNI), nothing in your code should ever make JVM crash; so the stack trace information in that log file is probably not meant to be very useful to most developers. That's probably why it might not be documented (at least externally).
So the best thing is probably to file a bug report as suggested by the error message.
This presentation contains a detailed explanation of crash files, with a set of samples so you can practice.
首先,查找看起来像“ntdll.dll+0x2000”的最上面一行。
如果热点出现在您的本机代码中(即 DLL 是您的代码之一),那么请了解如何说服您的编译器生成从 DLL 偏移量到行号的映射列表。 显然,这可能意味着您需要使用新编译的 DLL 重新运行并等待问题再次出现。
否则,看看搜索该特定行是否会在 Google 中显示某些内容,请记住,相同的错误可能意味着很多事情。 并查看 DLL 名称是否看起来是可识别的,例如打印机驱动程序名称、图形驱动程序或您可以跟踪到特定调用的其他组件。 无论该组件是什么,您都可以将其升级到固定版本,或者避免进行有问题的调用。 如果您不确定该组件是什么,它可能只是您需要升级的“JVM”——至少升级到您所使用的任何版本的最新更新/次要版本号可能是个好主意。
过去,我也看到过 JIT 编译器中的错误,可以通过告诉它不要尝试编译有问题的特定方法来临时解决这些错误 - 我模糊地记得,在这些情况下,热点错误提供了一些线索它是哪种方法(可能只是 Java 堆栈的转储),但我没有手头的示例来回忆细节。
To start with, look for the topmost line that looks something like "ntdll.dll+0x2000".
If the hotspot is occurring in your native code (i.e. the DLL is one of yours), then find out how to persuade your compiler to produce a list of mappings from DLL offset to line number. Obviously, that may mean you need to re-run with the newly compiled DLL and wait for the problem to occur again.
Otherwise, see if searching for that specific line brings up something in Google, bearing in mind that the same error could mean a whole host of things. And see if the DLL name looks like it's something recognisable, e.g. a printer driver name, graphics driver, or some other component that you can track down to a particular call. Whatever that component is, you may be able to upgrade it to a fixed version, or avoid making the call in question. If you're not sure what the component is, it may just be "the JVM" that you need to upgrade-- upgrading at least to the latest update/minor version nubmer of whatever version you're on is probably a good idea.
In the past I've also seen bugs in the JIT compiler that can be temporarily solved by telling it not to attempt to compile the particular method in question-- as I recall vaguely, in these cases, the hotspot error gives some clue as to which method it was (possibly just the dump of the Java stack), but I don't have an example to hand to recall the details.
这非常有用: http://weblogs.java.net /blog/kohsuke/archive/2009/02/crash_course_on.html
好的,第一个 anwser 已经提到了这个网址,没关系
this is pretty useful: http://weblogs.java.net/blog/kohsuke/archive/2009/02/crash_course_on.html
ok the first anwser already mentions this url, nevermind