Linux下TomcatVM参数修改:Native memory allocation (mmap) failed to map 3221225472 bytes for committing reserved memory.
2017-01-01 00:01
645 查看
不可行的方法
最初我直接修改catalina.sh, 将JAVA_OPTS变量加上了
-server -Xms1G -Xmx1G -XX:+UserG1GC
最初看起来没啥问题,但是当服务器运行几天后,发现执行shutdown.sh无法关闭tomcat, 错误信息如下:
# root@iZ94hjppdqzZ:~/projects/taolijie# cat hs_err_pid5519.log # There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.# 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 (os_linux.cpp:2673), pid=5519, tid=3061726064## JRE version: (8.0_45-b14) (build )# Java VM: Java HotSpot(TM) Server VM (25.45-b02 mixed mode linux-x86 )# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again#
关闭个tomcat要请求1G的内存, 当时服务器就剩下200M内存,所以Out Of Memory了。查看shutdown.sh,发现它其实还是调用了catalina.sh,只是传入了一个stop参数。而catalina.sh是执行了
org.apache.catalina.startup.Bootstrap stop
来向tomcat发送关闭信息的。由于上面我们设置了JAVA_OPTS使用1G的堆,因此执行该类时JVM会向系统申请1G多的内存,直接导致Out Of Memory。
可行的方法
在catalina.sh的第二行添加:
CATALINA_OPTS="$CATALINA_OPTS -server -Xms1G -Xmx1G -XX:+UseG1GC"
这些VM参数就会只应用到catalina而不是所有Tomcat进程。
我的方式,参考上面参数设置启发,设置了-Xms1G -Xmn1G就好了,shutdown.sh就能用了
最初我直接修改catalina.sh, 将JAVA_OPTS变量加上了
-server -Xms1G -Xmx1G -XX:+UserG1GC
最初看起来没啥问题,但是当服务器运行几天后,发现执行shutdown.sh无法关闭tomcat, 错误信息如下:
# root@iZ94hjppdqzZ:~/projects/taolijie# cat hs_err_pid5519.log # There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.# 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 (os_linux.cpp:2673), pid=5519, tid=3061726064## JRE version: (8.0_45-b14) (build )# Java VM: Java HotSpot(TM) Server VM (25.45-b02 mixed mode linux-x86 )# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again#
关闭个tomcat要请求1G的内存, 当时服务器就剩下200M内存,所以Out Of Memory了。查看shutdown.sh,发现它其实还是调用了catalina.sh,只是传入了一个stop参数。而catalina.sh是执行了
org.apache.catalina.startup.Bootstrap stop
来向tomcat发送关闭信息的。由于上面我们设置了JAVA_OPTS使用1G的堆,因此执行该类时JVM会向系统申请1G多的内存,直接导致Out Of Memory。
可行的方法
在catalina.sh的第二行添加:
CATALINA_OPTS="$CATALINA_OPTS -server -Xms1G -Xmx1G -XX:+UseG1GC"
这些VM参数就会只应用到catalina而不是所有Tomcat进程。
我的方式,参考上面参数设置启发,设置了-Xms1G -Xmn1G就好了,shutdown.sh就能用了
相关文章推荐
- Native memory allocation (mmap) failed to map 142606336 bytes for committing reserved memory.
- Kakfka启动报错: Native memory allocation (mmap) failed to map 1073741824 bytes ..解决方案
- IMF 传奇行动 启动SPARK master无法启动 内存不够问题解决) failed to map 715849728 bytes for committing reserved memory.
- failed to allocate XXXX bytes for committing reserved memory.
- Caused by: java.lang.OutOfMemoryError: Failed to allocate a 29433932 byte allocation with 14683576 free bytes and 14MB
- linux tomcat java.lang.OutOfMemoryError: unable to create new native thread
- sun jdk7 有问题 Native memory allocation (malloc) failed to allocate
- java.lang.OutOfMemoryError: Failed to allocate a 3110419 byte allocation with 741152 free bytes and
- tomcat 6.0.44 “has failed to stop it. This is very likely to create a memory leak” 问题调查
- How-to: resolve " java.lang.OutOfMemoryError: unable to create new native thread" for hbase thrift
- How to Install VM Tools for Linux Platform in VMware Workstation
- tomcat服务java.lang.OutOfMemoryError: unable to create new native thread
- tomcat 下部署的应用出现ava.lang.OutOfMemoryError: unable to create new native thread ,解决方案。
- 安卓工程修改包名后 Failed to find provider info for...问题
- nginx: [alert] mmap(MAP_ANON|MAP_SHARED, 536870912) failed (12: Cannot allocate memory)解决方法
- Linux 系统 vm.overcommit_memory 内核参数
- 修改通过myeclipse启动的tomcat的VM参数
- 剥下“java.lang.OutOfMemoryError: unable to create new native thread”的外衣 创建线程数公式(MaxProcessMemory - JVMMemory – ReservedOsMemory)
- 【linux】 vm.overcommit_memory 内核参数