Java OutOfMemory异常:加载zip文件时出现mmap错误 [英] Java OutOfMemory exception: mmap error on loading zip file
问题描述
我使用JVM参数在生产环境(rhel 5.2 x64,oracle jre 1.7_05,tomcat 7.0.28)上运行我的应用程序:
I run my app on production env (rhel 5.2 x64, oracle jre 1.7_05, tomcat 7.0.28) with JVM arguments:
-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
经过好几次有这样的堆栈跟踪:
After several time i've got stack trace like that:
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]
查看我的探查器 - everthing没问题(堆和非堆内存使用10%),我不知道问题出在哪里。
Looking to my profiler - everthing is ok (heap and non-heap memory used for 10%) and i have no idea where is the problem.
这个公关oblem每天都在同一时间发生,并且与应用程序正常运行时间无关。导致问题的原因是什么?
This problem's happening every day at same time and it's not connected to application uptime. What is cause it problem?
编辑:
日志文件中的新输出:
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 </ code>与
比较cat / proc / sys / vm / max_map_count
I have seen these error before when running out of resources such as running out of swap space or running out of allowed memory mapping. Have a look at sudo cat /proc/$PID/maps | wc -l
compared with cat /proc/sys/vm/max_map_count
参见评论如下。
我还建议....
您似乎遇到了YourKit的错误。你使用的是什么版本?
You appear to have run into a bug with YourKit. What version are you using?
我会减少你的大多数选项,因为它们是默认选项,不做任何事情或可能使问题复杂化。
I would cut down most of your options as they either are the default and don't do anything or could be complicating matters.
-mx8g -XX:MaxPermSize=1g -Doracle.net.tns_admin=/var/ora_net
-XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Dcom.sun.management.jmxremote.port=9026
我会尝试删除 -XX:+ UseG1GC
以及这是一个相对较新的收藏家,不应该改变你的结果。
I would try dropping -XX:+UseG1GC
as well as this is a relatively new collector and shouldn't change your results.
这篇关于Java OutOfMemory异常:加载zip文件时出现mmap错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!