ITeye博客

JVM Crash原因分析及相关资料

SeanHe · 2011-02-14 15:53 · java · 编程语言 · Markdown

去年生产环境突然有一天连续发生几台服务器JVM Crash的情况。出现这种情况的时候JVM留下的error log基本相同

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00002b28192a24f0, pid=28485, tid=1088477504

JRE version: 6.0_18-b07

Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b13 mixed mode linux-amd64 )

Problematic frame:

V

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

--------------- T H R E A D ---------------

Current thread (0x00002aab4803e800): JavaThread "CompilerThread1" daemon

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x000000000000002c

此处略去N个字...

Current CompileTask: C2:171% ! org.mule.esb.impl.core.provider.spring.EsbClientBean.invoke(Ljava/lang/reflect/Method;

巧合的是crash时JVM都在做同一件事情“Current CompileTask: C2:171% ! org.mule.esb.impl.core.provider.spring.EsbClientBean.invoke(Ljava/lang/reflect/Method;http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzu>

If the fatal error log output shows that the Current thread is a JavaThread named CompilerThread0, CompilerThread1, or AdapterCompiler, then it is possible that you have encountered a compiler bug. In this case it might be necessary to temporarily work around the issue by switching the compiler (for example, by using the HotSpot Client VM instead of the HotSpot Server VM, or visa versa), or by excluding from compilation the method that provoked the crash. This is discussed in 4.2.1 Crash in HotSpot Compiler Thread or Compiled Code.

原文的意思简单的说:当在错误日志中显示“the Current thread is a JavaThread named CompilerThread0, CompilerThread1, or AdapterCompiler”时,可能是触发了JVM的编译器的BUG导致的。

解决办法见这里的描述http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzd 主要有两类: 1.JVM使用client模式,即去掉“-server”参数改用“-client” 2.过滤掉会导致JVM crach的一些方法不执行编译优化。具体有两种做法:a.在程序的工作路径创建.hotspot_compiler文件,文件内容类似这样:


exclude org/mule/esb/impl/core/provider/spring/EsbClientBean invoke

。b.在jvm启动参数中添加启动参数


-XX:CompileCommand=exclude,org/mule/esb/impl/core/provider/spring/EsbClientBean,invoke 

可以达到同样的效果。

因为第一类解决方法会整体影响应用服务器的性能,所以我们没有采用。第二类方法里我选择了b这种方式,修改启动脚本比较方便。

通过这次问题的解决,积累了一些资料可以供以后再解决此类问题。 1.一些常见的crash原因:http://www.oracle.com/technetwork/java/javase/crashes-137240.html 2.JVM crash error log format:http://www.oracle.com/technetwork/java/javase/felog-138657.html

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。