Java OutOfMemory异常:加载zip文件时出现mmap错误

前端之家收集整理的这篇文章主要介绍了Java OutOfMemory异常:加载zip文件时出现mmap错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我运行我的应用程序生产env(rhel 5.2 x64,oracle jre 1.7_05,tomcat 7.0.28)与JVM参数:
-Xms8192m -Xmx8192m -XX:MaxPermSize=1024m 
-Doracle.net.tns_admin=/var/ora_net -XX:ReservedCodeCacheSize=512m -XX:+AggressiveOpts -XX:+UseFastAccessorMethods 
-XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+UseG1GC -Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=9026 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

几次之后,我有堆栈跟踪:

Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages Failed.
Java HotSpot(TM) 64-Bit Server VM warning: Attempt to allocate stack guard pages Failed.
mmap Failed for CEN and END part of zip file
[...]
Caused by: java.lang.OutOfMemoryError: null
    at java.util.zip.ZipFile.$$YJP$$open(Native Method) ~[na:1.7.0_05]
    at java.util.zip.ZipFile.open(Unknown Source) ~[na:1.7.0_05]
    at java.util.zip.ZipFile.<init>(Unknown Source) ~[na:1.7.0_05]
    at java.util.zip.ZipFile.<init>(Unknown Source) ~[na:1.7.0_05]
    at java.util.jar.JarFile.<init>(Unknown Source) ~[na:1.7.0_05]
    at java.util.jar.JarFile.<init>(Unknown Source) ~[na:1.7.0_05]
    at sun.net.www.protocol.jar.URLJarFile.<init>(Unknown Source) ~[na:1.7.0_05]
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source) ~[na:1.7.0_05]
    at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source) ~[na:1.7.0_05]
    at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source) ~[na:1.7.0_05]
    at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source) ~[na:1.7.0_05]
    at java.net.URL.openStream(Unknown Source) ~[na:1.7.0_05]
    at org.apache.catalina.loader.WebappClassLoader.findLoadedResource(WebappClassLoader.java:3279) ~[na:na]
    at org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1478) ~[na:na]
    at org.apache.http.util.VersionInfo.loadVersionInfo(VersionInfo.java:242) ~[httpcore-4.2.jar:4.2]
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:180) ~[httpclient-4.2.jar:4.2]
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158) ~[httpclient-4.2.jar:4.2]
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448) ~[httpclient-4.2.jar:4.2]

看着我的分析器 – 一切都很好(堆和非堆内存用于10%),我不知道问题在哪里.

这个问题每天都在同一时间发生,它没有连接到应用程序正常运行时间.原因是什么问题?

编辑:

日志文件中的新输出

Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
Code Cache  [0x00002aaaab790000,0x00002aaaad240000,0x00002aaacb790000)
 total_blobs=4223 nmethods=3457 adapters=707 free_code_cache=497085Kb largest_free_block=508887936

但我有足够的记忆:http://i.stack.imgur.com/K8VMx.jpg

回答:
java版本中的问题这里描述:https://forums.oracle.com/forums/thread.jspa?messageID=10369413

解决方法

之前我已经看到这些错误,当运行的资源,如运行的交换空间或运行的允许的内存映射之前.看看sudo cat / proc / $PID / maps | wc -l与cat / proc / sys / vm / max_map_count进行比较

见下面的评论.

我也建议….

你似乎遇到了一个与你的Kit的bug.你使用什么版本?

我会削减大部分的选择,因为他们是默认的,不做任何事情或可能会使事情复杂化.

-mx8g -XX:MaxPermSize=1g -Doracle.net.tns_admin=/var/ora_net 
-XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Dcom.sun.management.jmxremote.port=9026

我会尝试放弃-XX:UseG1GC以及这是一个相对较新的收藏家,不应该改变你的结果.

猜你在找的Java相关文章