Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-1926

Display nice error message and don't truncate the generate Zip when exporting a large page that requires more heap space than there is

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 1.2 RC1
    • Old Core
    • N/A
    • N/A

    Description

      Here's what happen when a large page is exported when there's not enough heap space:
      1) there's an OOM error in the log (see below)
      2) the generated zip is truncated making it invalid

      10:09:26,820 [http://www.xwiki.org/xwiki/bin/view/Packager/Export?package=Packager.UserGuidePages] [http-8080-11] ERROR log.SimpleLog4JLogSystem        - Method export threw exception for reference $export in template Packager.Export at  [25,3] 
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'export' in  class com.xpn.xwiki.plugin.packaging.PackageAPI threw exception java.lang.OutOfMemoryError: Java heap space @ Packager.Export[25,11]
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:300)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:238)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:152)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.render(XWikiVelocityRenderer.java:95)
      	at com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:251)
      	at com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:176)
      	at com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:145)
      	at com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderDocument(DefaultXWikiRenderingEngine.java:134)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:407)
      	at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:371)
      	at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:238)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:152)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1353)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1322)
      	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:605)
      	at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:194)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:238)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:152)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1353)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1322)
      	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:105)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:158)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
      	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:175)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      	at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.OutOfMemoryError: Java heap space
      	at java.util.Arrays.copyOf(Arrays.java:2882)
      	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
      	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
      	at java.lang.StringBuffer.append(StringBuffer.java:224)
      	at java.io.StringWriter.write(StringWriter.java:84)
      	at org.dom4j.io.XMLWriter.writeNodeText(XMLWriter.java:1291)
      	at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1311)
      	at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1122)
      	at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:949)
      	at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
      	at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1136)
      	at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
      	at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
      	at org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1136)
      	at org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
      	at org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
      	at org.dom4j.io.XMLWriter.write(XMLWriter.java:344)
      	at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:2032)
      	at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:2088)
      	at com.xpn.xwiki.plugin.packaging.Package.addToZip(Package.java:807)
      	at com.xpn.xwiki.plugin.packaging.Package.export(Package.java:334)
      	at com.xpn.xwiki.plugin.packaging.PackageAPI.export(PackageAPI.java:169)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      

      We should display a proper error message and discard the generate zip.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              vmassol Vincent Massol
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: