core icon indicating copy to clipboard operation
core copied to clipboard

OutOfMemoryError from ZipFile

Open rosselet opened this issue 14 years ago • 6 comments

Hi, We regularly are getting this error after the dotcms server has been running for a while, This is in a single user environment with plenty of memory. This error has been a long standing error in the jvm although supposedly fixed (e.g. , and the suggested work around has been to use ZipInputStream instead of ZipFile. We are runing on 64bit linux with oracle/sun jdk 1.7. Is there an existing workaround/fix, or can this be fixed? If this is a problem with jvm settings, are there any guidelines for settings?

possibly related links: http://www.velocityreviews.com/forums/t144852-opening-a-zip-causes-outofmemoryerror.html http://bugs.sun.com/bugdatabase/viewbug.do?bugid=4705373

[21/09/12 16:42:43:407 CEST] ERROR [/].[MainServlet]: Servlet.service() for servlet MainServlet threw exception java.lang.OutOfMemoryError at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:214) at java.util.zip.ZipFile.(ZipFile.java:144) at java.util.jar.JarFile.(JarFile.java:152) at java.util.jar.JarFile.(JarFile.java:116) at org.apache.catalina.loader.WebappClassLoader.openJARs(WebappClassLoader.java:2427) at org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2667) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2462) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361) at com.liferay.portal.action.LoginAction._login(LoginAction.java:271) at com.liferay.portal.action.LoginAction.execute(LoginAction.java:99) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:157) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:275) at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:135) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.CMSFilter.doFilter(CMSFilter.java:128) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.AutoLoginFilter.doFilter(AutoLoginFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.cms.urlmap.filters.URLMapFilter.doFilter(URLMapFilter.java:86) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.TimeMachineFilter.doFilter(TimeMachineFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:140) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:722)

rosselet avatar Sep 22 '12 20:09 rosselet

are you using our out of the box tomcat or did you try to build a WAR.

We run this all the time and have run in JDK 1.7 without getting this. Not sure what is wrong with your local environment.

jtesser avatar Sep 24 '12 12:09 jtesser

Hi, which do you use the out of the box, or build dotcms war? Could you please let us know what your environment/settings are. We are running out of the box dotcms, on jdk 1.7_04, 64bit openSuse 12.1, currently with only 1 user, -Xmx2G (same problem with 3GB), -maxpermsize 256Mb. we have tried both UseConcMarkSweepGC and UseG1GC (helped other problems)..but the same.

rosselet avatar Sep 24 '12 13:09 rosselet

Well in community we only recommend and support running our built in install.

Basically no need for you to build a WAR this is Enterprise Only. If you are running on your own tomcat I would assume the issue is with it or the way the WAR is built.

jtesser avatar Sep 24 '12 13:09 jtesser

we ARE running/using the the built in version and encountering this sometimes when saving a page. Are there any guidelines for jvm settings, or should the entire thing work perfectly out of the box - w/o any need to change any tomcat startup settings etc??

rosselet avatar Sep 24 '12 15:09 rosselet

should work out of box. when you alter settings to be clear you should only edit our bin/startup and NOT anything in tomcat's bin. In fact make sure that is how you are starting dotcms also. NOT from tomcats bin but the bin at the root of the dotcms directory.

We don't get the issue you are seeing anywhere and it is pretty strange. Seems like something is wrong with the environment.

jtesser avatar Sep 24 '12 15:09 jtesser

Hi, just to let you know in case anyone else runs into this problem. It seems to have been caused by having openJdk installed as default java on the server. Although dotCMS was running using sun/oracle jdk 1.7 (also installed), it appears that when performing some NIO calls, the 'default' java was being used, and either the combination of the two, or openJDK itself caused this bug...

rosselet avatar Oct 09 '12 07:10 rosselet