Linux下TomcatVM参数修改:Native memory allocation (mmap) failed to map 3221225472 bytes for committing reserved memory.
不可行的方法
最初我直接修改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就能用了
Linux下TomcatVM参数修改:Native memory allocation (mmap) failed to map 3221225472 bytes for committing reserved memory.的更多相关文章
- Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory
遇到问题 在服务器上运行 nexus 出现Native memory allocation (mmap) failed to map 838860800 bytes for committing re ...
- Native memory allocation (mmap) failed to map 142606336 bytes for committing reserved memory.
这里写链接内容 问题描述 Java程序运行过程中抛出java.lang.OutOfMemoryError: unable to create new native thread,如下所示: [java ...
- linux 下tomcat出现 Native memory allocation (malloc) failed to allocate 1915224064 bytes for committing reserved memory问题
## There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocat ...
- Linux下配置tomcat+apr+native应对高并发
摘要:在慢速网络上Tomcat线程数开到300以上的水平,不配APR,基本上300个线程狠快就会用满,以后的请求就只好等待.但是配上APR之后,Tomcat将以JNI的形式调用Apache HTTP服 ...
- (转)Linux下配置tomcat+apr+native应对高并发
摘要:在慢速网络上Tomcat线程数开到300以上的水平,不配APR,基本上300个线程狠快就会用满,以后的请求就只好等待.但是配上APR之后,Tomcat将以JNI的形式调用Apache HTTP服 ...
- Linux 下网卡参数配置
目录 Linux 下网卡参数配置 第一种:修改 interfaces 文件 网卡配置实例 回环参数配置 DHCP方式配置 静态 IP 地址分配 无线网卡配置 March 17, 2015 7:48 P ...
- linux 下查看文件修改时间
linux 下查看文件修改时间 等 http://blog.sina.com.cn/s/blog_6285b04e0100f4xr.html 查看文件时间戳命令:stat awk.txtFile: ` ...
- docker环境下mysql参数修改
原文:docker环境下mysql参数修改 需要修改log_bin为on,看了好几个博客说都需要删掉容器重新生成,然而并非如此, 我们可以用docker cp 命令将docker的文件"下载 ...
- linux下C++遍历文件夹下的全部文件;Windows/Linux下C++批量修改文件名,批量删除文件
Linux下 C++遍历目录下所有文件 rename(image_path.c_str(), image_path_new.c_str()); remove(image_path_move.c_str ...
随机推荐
- 在webstorm设置File watcher for Jade
用Jade模板引擎写html确实方便,元素不用闭合,很多种简写的方法. 为了要知道自己写的对不对,就要用到jade -w命令监控jade文件,只要变化就编译. 现在用webstorm写代码的超多,可以 ...
- C#正则表达式Regex常用匹配
使用Regex类需要引用命名空间:using System.Text.RegularExpressions; 利用Regex类实现验证 示例1:注释的代码所起的作用是相同的,不过一个是静态方法,一个是 ...
- js+html5双人五子棋(源码下载)
代码如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" c ...
- 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox
[源码下载] 背水一战 Windows 10 (28) - 控件(文本类): TextBox, PasswordBox 作者:webabcd 介绍背水一战 Windows 10 之 控件(文本类) T ...
- 纪念品分组 2007年NOIP全国联赛普及组
题目描述 元旦快到了,校学生会让乐乐负责新年晚会的纪念品发放工作.为使得参加晚会的同学所获得的纪念品价值相对均衡,他要把购来的纪念品根据价格进行分组,但每组最多只能包括两件纪念品,并且每组纪念品的价格 ...
- Servlet转码问题
HttpServletRequest获取页面数据 提交表单时,Servlet直接从页面通过HttpServletRequest对象的getParameter(String arg0)获取参数时 默认编 ...
- No.007:Reverse Integer
问题: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321 官方难度: Ea ...
- (原) 2.3 Curator使用
本文为原创文章,转载请注明出处,谢谢 Curator使用 1.jar包引入,演示版本为2.6.0,非maven项目,可以下载jar包导入到项目中 <dependency> <grou ...
- logstash VS splunk
web 系统是典型的分布式部署,由此对其运行状况,硬件运转情况监控也显得尤为重要,这些监控数据表面上对业务运行没有多大的用处(属于基础数据),但正是这些基础数据形成了业务“流”.比如,用户搜索爱好,浏 ...
- 单行文字滚动就用myslider
单行文字滚动就用myslider,myslider是一个小型的内容滚动jquery插件. 首先请看实例:http://keleyi.com/jq/myslider/demo/4.htm 然后来看代码: ...