Tomcat异常停止

2014-12-04 02:25:20(UTC)左右tomcat异常停止

当前内存使用如下:

ops@vms-103:/var/log$ free -m
             total       used       free     shared    buffers     cached
Mem:          7974       5349       2624          0        214       2180
-/+ buffers/cache:       2954       5019
Swap:         4095          9       4086

ops@vms-103:/var/log$ ps uax|grep tomcat
tomcat6  24099 35.6 20.7 3277120 1692012 ?     Sl   02:38  51:38 /usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties -Djava.awt.headless=true -server -Xms2048M -Xmx2048M -XX:MaxPermSize=512M -Djava.security.auth.login.config=/usr/share/tomcat6/conf/jaas.conf -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -classpath /usr/share/tomcat6/bin/bootstrap.jar -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-tomcat6-tmp org.apache.catalina.startup.Bootstrap start
ops      29977  0.0  0.0   3344   716 pts/0    S+   05:02   0:00 grep tomcat

ops@vms-103:/var/log$ sudo -u tomcat6 jmap -heap `ps aux|grep tomcat|grep -v grep|awk '{print $2}'`
Attaching to process ID 24099, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 20.1-b02

using thread-local object allocation.
Parallel GC with 4 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 2147483648 (2048.0MB)
   NewSize          = 1048576 (1.0MB)
   MaxNewSize       = 4294901760 (4095.9375MB)
   OldSize          = 4194304 (4.0MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 16777216 (16.0MB)
   MaxPermSize      = 536870912 (512.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 705167360 (672.5MB)
   used     = 94582944 (90.20132446289062MB)
   free     = 610584416 (582.2986755371094MB)
   13.4128363513592% used
From Space:
   capacity = 5242880 (5.0MB)
   used     = 3473528 (3.3126144409179688MB)
   free     = 1769352 (1.6873855590820312MB)
   66.25228881835938% used
To Space:
   capacity = 5308416 (5.0625MB)
   used     = 0 (0.0MB)
   free     = 5308416 (5.0625MB)
   0.0% used
PS Old Generation
   capacity = 1431699456 (1365.375MB)
   used     = 335996904 (320.4316177368164MB)
   free     = 1095702552 (1044.9433822631836MB)
   23.468396428586754% used
PS Perm Generation
   capacity = 183238656 (174.75MB)
   used     = 87843752 (83.77433013916016MB)
   free     = 95394904 (90.97566986083984MB)
   47.93953083785989% used

异常日志:
catalina.out
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate
# An error report file with more information is saved as:
# /tmp/hs_err_pid17020.log

ops@vms-103:/var/lib/tomcat6/logs$ cat /tmp/hs_err_pid17020.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:211), pid=17020, tid=1384852336
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) Server VM (20.1-b02 mixed mode linux-x86 )

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

Current thread (0x092c9400):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=17030, stack(0x52833000,0x528b3000)]

Stack: [0x52833000,0x528b3000],  sp=0x528afd90,  free space=499k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)


通过看log,其实已经给了我们出错的原因和建议。
出错原因:Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool
建议:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=

实际上,tomcat设置了2G内存,系统占用了1G内存,再一些七七八八的内存占用了300m,所以3.3G已经使用了。当线程比较多的时候,占用超过700m,就会导致内存无法开辟而出错
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值