java.lang.OutOfMemoryError:Out of swap space?

        近期遇到一个JVM崩溃问题,JVM在运行不定时间后会崩溃,崩溃的时间没发现有什么规律,有多是一两天,有多是一个月,近半年大概发生了3次,在第三次发生的时候终于引发了楼主的关注,楼主决定想办法处理掉它,下面分享一下处理的过程。java

        首先贴上hs.log(日志太长,只贴出一部分),以下:nginx

#
# An unexpected error has been detected by Java Runtime Environment:
#
# java.lang.OutOfMemoryError: requested 1310720 bytes for GrET in C:\BUILD_AREA\jdk6_07\hotspot\src\share\vm\utilities\growableArray.cpp. Out of swap space?
#
#  Internal Error (allocation.inline.hpp:42), pid=3640, tid=5204
#  Error: GrET in C:\BUILD_AREA\jdk6_07\hotspot\src\share\vm\utilities\growableArray.cpp
#
# Java VM: Java HotSpot(TM) Server VM (10.0-b23 mixed mode windows-x86)
# 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 (0x65b7e400):  VMThread [stack: 0x66bf0000,0x66c40000] [id=5204]

Stack: [0x66bf0000,0x66c40000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]

VM_Operation (0x713bf5d4): ParallelGCFailedAllocation, mode: safepoint, requested by thread 0x6a8e1000

        相信不少人会和楼主同样,第一眼就定位到Out of swap space,交换空间溢出?什么鬼?彻底没遇到过,因而百度了一下,发现也有很多遇到此类问题的,大概看了一些回复,都是诸如:增长内存配置,增长操做系统交换空间之类的。仔细阅读了下崩溃日志,发现内存回收正常。跟内存溢出彻底不要紧呀web

java.lang.OutOfMemoryError: requested 1310720 bytes for GrET in C:\BUILD_AREA\jdk6_07\hotspot\src\share\vm\utilities\growableArray.cpp. Out of swap space?windows

从新解读一下上述英文描述:为GrET申请内存时交换空间溢出,并且标出路径在C:\BUILD_AREA\jdk6_07\hotspot\src\share\vm\utilities\growableArray.cpp里,初步能够判定问题是发生在growableArray.cpp这里,首先百度下growableArray.cpp是什么,此次好像查到点上了,在Oracle的bug库里找到了这个问题,详情请戳:JDK-6806226 : Signed integer overflow in growable array code causes JVM crashapp

Bug Description中提到,在growableArray.cpp存在一个有符号数溢出的Bug,在堆比较大的状况下会致使JVM崩溃。webapp

缘由终于找到了,原来是几年前JVM的一个Bug,已经在jdk1.6.0_14里修复。楼主从几个相关的报告中找到了几种解决方法,以下:jsp

1.bug已经在jdk 6 update 14中修复,只要升级到jdk1.6.0_14以后的版本便可ide

6806226 is fixed in jdk 6 update 14.

2.使用 -XX:+UseParallelOldGC垃圾收集器替代,不想升级jdk的能够试试这个应急方法spa

The UseParallelOldGC does not need to move aside the mark words so
does not need to do the allocation that fails.  Use -XX:+UseParallelOldGC
as a workaround.

3.hotspot虚拟机版本使用24.0以后的版本操作系统

The code in hsx24 has been fixed.

楼主选择了升级jdk方法,目前JVM运行稳定,还没有出现此问题,持续观察中。。。

相关文章
相关标签/搜索