After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)
12 posts by 7 authors
Patrick Heppler 
10/28/13
 
Hi,

I'm running railo 4.1.1.009 on a centos box. Today I updated JRE (Oracle) from jre-7_21 to jre-7_45. And now when starting jetty I get:
Starting Jetty: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000007e0000000, 536870912, 2097152, 0) failed; error='Cannot allocate memory' (errno=12)
 
With jre-7_21 I had no issue. Railo is running fine, anyway. 
 
My Java Args (from a Railo Blog ;) ):
-server -Djava.io.tmpdir=/dev/shm -javaagent:/opt/jetty/lib/ext/railo-inst.jar -Dsun.io.useCanonCaches=false -Xms1024m -Xmx2048m -XX:PermSize=512M -XX:MaxPermSize=512M -XX:NewSize=512M -XX:MaxNewSize=512M  -XX:GCTimeRatio=5 -XX:ThreadPriorityPolicy=42 -XX:ParallelGCThreads=4 -XX:+UseParNewGC -XX:MaxGCPauseMillis=50 -XX:+DisableExplicitGC -XX:MaxHeapFreeRatio=70 -XX:MinHeapFreeRatio=40 -XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+UseTLAB -XX:+ScavengeBeforeFullGC -XX:CompileThreshold=1500 -XX:+TieredCompilation -XX:+UseBiasedLocking -Xverify:none -XX:+UseThreadPriorities -XX:+UseLargePages  -XX:LargePageSizeInBytes=2m -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -Djava.security.egd=/dev/urandom -Dfile.encoding=UTF-8 -Duser.language=de -Duser.region=DE -Duser.timezone=Europe/Berlin -Dcoldfusion.jsafe.defaultalgo=FIPS186Random
 
 
 
 
Phil Sweeney 
11/2/13
 
To be honest, I think using a bunch of JVM flags from blogs/google searches is a bad idea, and is potentially why you have run into this problem.

When I went through this exercise late last year, I researched each flag I saw mentioned around the place.  Most of them were already set as default in modern JVMs and others were simply misunderstood.

For our high traffic (and now very fast) site, this is all I have for my JVMs:

export CATALINA_OPTS="-Xms768m \
                      -Xmx768m \
                      -XX:NewSize=448m \
                      -XX:MaxNewSize=448m \
                      -XX:MaxTenuringThreshold=32 \
                      -XX:MaxPermSize=128m \
                      -XX:+UseConcMarkSweepGC \
                      -XX:+CMSClassUnloadingEnabled \
                      -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses \

The New size relates to the nature of the site, in that it has much more temporary allocations than permanent.  But I did that based on analysis with visualvm and then testing.
Obviously you would choose your memory sizes based on your site profile.

But every single one is there for a demonstrable reason.

Phil

- show quoted text -
 
 
 
 
Igal 
11/2/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)

I think using a bunch of JVM flags from blogs/google searches is a bad idea, and is potentially why you have run into this problem.

I agree

but having said that I think that you also set some flags that you shouldn't mess with (like MaxNewSize and MaxTenuringThreshold) unless you have a very good reason to do so.

I recommend setting the following flags:

    -Xms={minimum-heap-memory-in-mb}m
    -Xmx={maximum-heap-memory-in-mb}m
    -XX:MaxPermSize={maximum-perm-gen-in-mb}m
    -XX:+HeapDumpOnOutOfMemoryError

the memory values should be set according to physical RAM size.  MaxPermSize should be 256m if possible (though 128m can be used as minimum), and -Xmx should be between 1024m and 4096m, again, depends on available RAM.

- show quoted text -
- show quoted text -

-- 
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
--- 
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/88afc251-7daa-4ad4-8d1b-bcd7a651ea3b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Igal Sapir
Railo Core Developer
http://getRailo.org/
 
 
 
 
Patrick Heppler 
11/4/13
 
Just FYI https://www.farbeyondcode.com/Optimizing-Tomcat-s-JVM-Options-for-Railo-4-1-5-3001.html

This is where I got this settings from. But I'll try the JVM Settings recommended

Am Montag, 28. Oktober 2013 12:53:35 UTC+1 schrieb Patrick Heppler:

- show quoted text -
 
 
 
 
Kai Koenig 
11/5/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)
That's fine, but be aware and warned that JVM/GC settings are always heavily depending on one's hardware, OS, configuration, application as well as _optimisation goals_.

 
I strongly advise against copying any sort of JVM/GC settings from anyone's blog or tutorial. They might really well work for Bruce's setup but they might (and apparently do) cause issue for you.
 
Cheers
Kai
- show quoted text -
 
 
 
 
Igal 
11/5/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)

This is where I got this settings from

then I suggest that Bruce update his blog post ;)

- show quoted text -
- show quoted text -
-- 
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
--- 
You received this message because you are subscribed to the Google Groups "Railo" group.

To view this discussion on the web visit https://groups.google.com/d/msgid/railo/585C7698-F6A1-4422-9DA1-D26019A8AE9D%40gmail.com.

--
Igal Sapir
Railo Core Developer
http://getRailo.org/
 
 
 
 
Patrick Heppler 
11/11/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)
I now switched back from custom jetty setup to railo/tomcat (installer bundle) because I had an issue with javaagent.

 
I now have this Java Opts:
JAVA_OPTS="-server -Djava.io.tmpdir=/dev/shm -javaagent:/usr/share/nginx/html/example.com/WEB-INF/lib/railo-inst.jar -Dsun.io.useCanonCaches=false -Xms1024m -Xmx2048m -XX:MaxPermSize=256M -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=/dev/urandom -Dfile.encoding=UTF-8 -Duser.language=de -Duser.region=DE -Duser.timezone=Europe/Berlin -Dcoldfusion.jsafe.defaultalgo=FIPS186Random";
 
I still get the memory errors, not on railo start but on restart. Linux top command shows more then 1.4 GB free while railo is running.
Railo Server Admin shows 30% Heap and 20% Non-Heap used.
 

Am Montag, 4. November 2013 20:40:06 UTC+1 schrieb Igal:

- show quoted text -
 
 
 
 
Chris Blackwell 
11/11/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)
Patrick (and Bruce)

 
Do not use JAVA_OPTS to pass arguments to tomcat, use CATALINA_OPTS
 
 
basically, if you set -Xms1024m in JAVA_OPTS the java process that is spawned to restart tomcat also uses that amount of memory, so only use global options in JAVA_OPTS, not per process stuff which for tomcat should be placed in CATALINA_OPTS.
 
Chris
- show quoted text -
- show quoted text -

To view this discussion on the web visit https://groups.google.com/d/msgid/railo/39c735b9-e2ee-4486-8647-ee7f25621066%40googlegroups.com.

 
 
 
 
Jordan Michaels 
11/12/13
 
Re: [railo] Re: After Update from jre-7_21 to jre-7_45: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory() failed; error='Cannot allocate memory' (errno=12)
Good find Chris!

https://github.com/utdream/CFML-Installers/issues/57

Warm Regards, 
Jordan Michaels

On 11/11/2013 07:28 AM, Chris Blackwell wrote: 
> Patrick (and Bruce) 

> Do not use JAVA_OPTS to pass arguments to tomcat, use CATALINA_OPTS 

> for an explanation of why, see -> 
http://www.wellho.net/mouth/2163_CATALINA-OPTS-v-JAVA-OPTS-What-is-the-difference-.html 

> basically, if you set -Xms1024m in JAVA_OPTS the java process that is 
> spawned to restart tomcat also uses that amount of memory, so only use 
> global options in JAVA_OPTS, not per process stuff which for tomcat 
> should be placed in CATALINA_OPTS. 

> Chris 


> On 11 November 2013 12:05, Patrick Heppler <slash...@googlemail.com 
> <mailto:slash...@googlemail.com>> wrote: 

>     I now switched back from custom jetty setup to railo/tomcat 
>     (installer bundle) because I had an issue with javaagent. 

>     I now have this Java Opts: 
>     JAVA_OPTS="-server -Djava.io.tmpdir=/dev/shm 
>     -javaagent:/usr/share/nginx/html/example.com/WEB-INF/lib/railo-inst.jar 

>     <http://example.com/WEB-INF/lib/railo-inst.jar>

>     -Dsun.io.useCanonCaches=false -Xms1024m -Xmx2048m 
>     -XX:MaxPermSize=256M -XX:+HeapDumpOnOutOfMemoryError 
>     -Djava.security.egd=/dev/urandom -Dfile.encoding=UTF-8 
>     -Duser.language=de -Duser.region=DE -Duser.timezone=Europe/Berlin 
>     -Dcoldfusion.jsafe.defaultalgo=FIPS186Random"; 

>     I still get the memory errors, not on railo start but on restart. 
>     Linux top command shows more then 1.4 GB free while railo is running. 
>     Railo Server Admin shows 30% Heap and 20% Non-Heap used. 


>     Am Montag, 4. November 2013 20:40:06 UTC+1 schrieb Igal: 

>>         This is where I got this settings from 
>         then I suggest that Bruce update his blog post ;) 


>         On 11/4/2013 11:38 AM, Kai Koenig wrote: 
>>         That's fine, but be aware and warned that JVM/GC settings are 
>>         always heavily depending on one's hardware, OS, configuration, 
>>         application as well as _optimisation goals_. 
>> 
>>         I strongly advise against copying any sort of JVM/GC settings 
>>         from anyone's blog or tutorial. They might really well work 
>>         for Bruce's setup but they might (and apparently do) cause 
>>         issue for you. 
>> 
>>         Cheers 
>>         Kai 
>> 
>>>         Just FYI 

>>>         https://www.farbeyondcode.__com/Optimizing-Tomcat-s-JVM-__Options-for-Railo-4-1-5-3001.__html

>>>         <https://www.farbeyondcode.com/Optimizing-Tomcat-s-JVM-Options-for-Railo-4-1-5-3001.html
>>> 
>>>         This is where I got this settings from. But I'll try the JVM 
>>>         Settings recommended 
>>> 
>>>         Am Montag, 28. Oktober 2013 12:53:35 UTC+1 schrieb Patrick 
>>>         Heppler: 
>>> 
>>>             Hi, 
>>>             I'm running railo 4.1.1.009 on a centos box. Today I 
>>>             updated JRE (Oracle) from jre-7_21 to jre-7_45. And now 
>>>             when starting jetty I get: 
>>>             Starting Jetty: Java HotSpot(TM) 64-Bit Server VM 

>>>             warning: INFO: os::commit_memory(__0x00000007e0000000,

>>>             536870912, 2097152, 0) failed; error='Cannot allocate 
>>>             memory' (errno=12) 
>>> 
>>>             With jre-7_21 I had no issue. Railo is running fine, anyway. 
>>> 
>>>             My Java Args (from a Railo Blog ;) ): 
>>>             -server -Djava.io.tmpdir=/dev/shm 

>>>             -javaagent:/opt/jetty/lib/ext/__railo-inst.jar

>>>             -Dsun.io.useCanonCaches=false -Xms1024m -Xmx2048m 
>>>             -XX:PermSize=512M -XX:MaxPermSize=512M -XX:NewSize=512M 
>>>             -XX:MaxNewSize=512M  -XX:GCTimeRatio=5 
>>>             -XX:ThreadPriorityPolicy=42 -XX:ParallelGCThreads=4 
>>>             -XX:+UseParNewGC -XX:MaxGCPauseMillis=50 
>>>             -XX:+DisableExplicitGC -XX:MaxHeapFreeRatio=70 
>>>             -XX:MinHeapFreeRatio=40 -XX:+UseStringCache 
>>>             -XX:+OptimizeStringConcat -XX:+UseTLAB 
>>>             -XX:+ScavengeBeforeFullGC -XX:CompileThreshold=1500 
>>>             -XX:+TieredCompilation -XX:+UseBiasedLocking 
>>>             -Xverify:none -XX:+UseThreadPriorities -XX:+UseLargePages 
>>>              -XX:LargePageSizeInBytes=2m -XX:+UseFastAccessorMethods 

>>>             -XX:+UseCompressedOops -Djava.security.egd=/dev/__urandom 
>>>             -Dfile.encoding=UTF-8 -Duser.language=de -Duser.region=DE 
>>>             -Duser.timezone=Europe/Berlin 
>>>             -Dcoldfusion.jsafe.__defaultalgo=FIPS186Random

>>> 
>> 
>> 
>>         -- 
>>         Did you find this reply useful? Help the Railo community and 
>>         add it to the Railo Server wiki at 

>>         https://github.com/getrailo/__railo/wiki

>>         <https://github.com/getrailo/railo/wiki
>>         --- 
>>         You received this message because you are subscribed to the 
>>         Google Groups "Railo" group. 
>>         To view this discussion on the web visit 

>>         https://groups.google.com/d/__msgid/railo/585C7698-F6A1-__4422-9DA1-D26019A8AE9D%__40gmail.com 
>>         <https://groups.google.com/d/msgid/railo/585C7698-F6A1-4422-9DA1-D26019A8AE9D%40gmail.com>. 
>>         For more options, visit 
>>         https://groups.google.com/__groups/opt_out 
>>         <https://groups.google.com/groups/opt_out>.


>         -- 
>         Igal Sapir 
>         Railo Core Developer 
>         http://getRailo.org/ 

>     -- 
>     Did you find this reply useful? Help the Railo community and add it 
>     to the Railo Server wiki at https://github.com/getrailo/railo/wiki 
>     --- 
>     You received this message because you are subscribed to the Google 
>     Groups "Railo" group. 
>     To view this discussion on the web visit 
>     https://groups.google.com/d/msgid/railo/39c735b9-e2ee-4486-8647-ee7f25621066%40googlegroups.com

>     For more options, visit https://groups.google.com/groups/opt_out

> -- 
> Did you find this reply useful? Help the Railo community and add it to 
> the Railo Server wiki at https://github.com/getrailo/railo/wiki 
> --- 
> You received this message because you are subscribed to the Google 
> Groups "Railo" group. 
> To view this discussion on the web visit 

https://groups.google.com/d/msgid/railo/CAB%3DtfToJGsJU%2BC5PiVU%3DJ6mq5Yz9voDkEAuuG7Tpy0_%2B6bSKyg%40mail.gmail.com.

- show quoted text -
 
 
 
 
I made some tweaks to the blog article now, but I still prefer the non-default options I use.  Some of them probably have no effect, others have a real effect on garbage collection timings.

 
My app runs a bunch of CMS sites that have very little write activity.  OS / Hardware is pretty typical.  Works good still.
- show quoted text -
 
 
 
 
Patrick Heppler 
11/12/13
 
Changed JAVA_OPTS to CATALINA_OPTS, works fine.

Am Montag, 28. Oktober 2013 12:53:35 UTC+1 schrieb Patrick Heppler:

Hi,

- show quoted text -
 
 
 
 
Bruce Kirkpatrick 
11/12/13
 
If that was the problem, I'd guess the system has not much memory available to the rest of the system.  You might want to leave around 25% of the memory unused so linux can cache stuff and avoid swapping.  I usually give Railo less then 1/3 of the total memory so database and other services have a 1/3 and system has a third.  I'd give database a greater share in a larger system.

- show quoted text -
 
 
 
 

java not enough memory error.的更多相关文章

  1. idea Error: java: OutOfMemoryError: insufficient memory 的处理

    idea Error: java: OutOfMemoryError: insufficient memory处理 在更新项目代码或者运行项目时报错 OutOfMemoryError: insuffi ...

  2. Myeclipse运行报错:an out of memory error has occurred的解决方法

    不知道怎么了,重装的myeclipse2013,里边就放了一个项目,启动myeclipse就报 an out of memory error has occurred....... 一点yes就退出 ...

  3. 解决:编译CM14.1 提示Jack “Out of memory error”错误

    Android 7.1编译到33%时出现JDK内存溢出的错误: Out of memory error (version f95d7bdecfceb327f9d201a1348397ed8a84384 ...

  4. 第一次JVM分析记录:Out of Memory Error (workgroup.cpp:96), pid=6196, tid=139999645685504

    tomcat的catalina.out日志报错如下: Exception in thread "http-bio-8081-Acceptor-0" java.lang.OutOfM ...

  5. elasticsearch报错[WARN ][bootstrap ] Unable to lock JVM Memory: error=12,reason=Cannot allocate memory,解决

    早上在服务器上安装elasticsearch集群,在其中的一台上面安装好elasticsearch之后安装了一些插件,其中一个插件是marvel,结果可能是新版本不支持这个插件,就没有安装成功,也就索 ...

  6. Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Lock wait timeout exceeded; try restarting transaction

    更新的时候报 Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Loc ...

  7. Java的Exception和Error面试题10问10答

    在Java核心知识的面试中,你总能碰到关于 处理Exception和Error的面试题.Exception处理是Java应用开发中一个非常重要的方面,也是编写强健而稳定的Java程序的关键,这自然使它 ...

  8. Tomcat启动报错:org.apache.catalina.LifecycleException: Failed to start component...java.util.zip.ZipException: error in opening zip file

    1.项目环境 IntelliJ IDEA2018.1.6 apache-tomcat-8.0.53 基于springboot开发的项目 maven3.5.3 2.出现问题 从svn同步下项目 启动to ...

  9. The "Out of socket memory" error

    The "Out of socket memory" error I recently did some work on some of our frontend machines ...

随机推荐

  1. MyBatis学习总结1

    MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.MyBatis可以使用简单的XML或注解用 ...

  2. 3 Financial Services Social Media Success Storie

    As financial services firms step-up their use of social media, we’ve been looking for some early suc ...

  3. bzoj1296

    首先先预处理每行刷1~m次最多能正确涂出多少格 然后把每行涂色看做一个物品,当重量为j(这行涂了j次),价值为对应能正确涂出的格子数: 总重量为k,然后做分组背包即可 ..,..,..] of lon ...

  4. c#中Lock(锁)的研究以及跨线程UI的操作

    本文只针对C#中,多线程同步所用到的锁(lock)作为研究对象.由于想更直观的显示结果,所以,在做demo的时候,就把多线程通过事件操作UI的代码也写了出来,留作备忘和分享吧.       其实多线程 ...

  5. HDU5654xiaoxin and his watermelon candy 离线+树状数组

    题意:bc 77div1 d题(中文题面),其实就是询问一个区间有多少不同的三元组,当然这个三元组要符合条件 分析(先奉上官方题解) 首先将数列中所有满足条件的三元组处理出来,数量不会超过 nn个. ...

  6. 找到的两个php爬虫,分享一下

    http://www.phpdig.net/ http://www.sphider.eu/ 虽然他们的文档我都看不太懂,甚至懒得去试一下安装,但还是留着吧,以后可能用得到吧

  7. 泰泽新闻:英特尔三星双否认泰泽Tizen系统已死

    7月8日 据媒体TizenExperts报道,关于“Tizen系统跳票”的传闻已经遭到了英特尔和三星否认. 此前传闻三星自行研制的智能手机Tizen操作系统流产,但如今已经遭到了官方的否认. 英特尔三 ...

  8. 搭建集群必备:windows如何使用Xshell远程连接(SSH)Linux

    出处about云(http://www.aboutyun.com/blog-61-22.html)欢迎访问我的博客 首先介绍一下环境: (主机)操作系统:win7 虚拟机:vmware worksta ...

  9. ZOJ-2365 Strong Defence 贪心,BFS

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2365 我没看懂题目...这样理解:一个有向图,要给一些边染色,使 ...

  10. Codeforces Round #341 (Div. 2) ABCDE

    http://www.cnblogs.com/wenruo/p/5176375.html A. Wet Shark and Odd and Even 题意:输入n个数,选择其中任意个数,使和最大且为奇 ...