JVM Crash原因分析及相关资料

去年生产环境突然有一天连续发生几台服务器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 [libjvm.so+0x5c04f0]
#
# 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 [_thread_in_native, id=28511, stack(0x0000000040d0d000,0x0000000040e0e000)]

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;[Ljava/lang/Object;)Ljava/lang/Object; @ 56 (492 bytes)

再次略去N个字...


巧合的是crash时JVM都在做同一件事情“Current CompileTask:
C2:171% ! org.mule.esb.impl.core.provider.spring.EsbClientBean.invoke(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; @ 56 (492 bytes)”
显示JIT在做编译优化的时候处理.EsbClientBean.invoke这个方法时出错。幸好SUN(Oracle)提供了相关的文档说明,得以让我们解决了这个问题。
文档地址:[url]http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzu[/url]
[quote]
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.
[/quote]
原文的意思简单的说:当在错误日志中显示“the Current thread is a JavaThread named CompilerThread0, CompilerThread1, or AdapterCompiler”时,可能是触发了JVM的编译器的BUG导致的。

解决办法见这里的描述[url]http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzd[/url]
主要有两类:
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原因:[url]http://www.oracle.com/technetwork/java/javase/crashes-137240.html[/url]
2.JVM crash error log format:[url]http://www.oracle.com/technetwork/java/javase/felog-138657.html[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值