I get Out of memory errors when uploading files to Confluence (v5.1.2). This happens with files > 25 MB.

      [confluence]  - Uploading file: Ipsos.MediaCell_v2.8_PanelistWebsite.zip (application/zip)
      ERROR: Unable to upload file...
      AxisFault
       faultCode: \{http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
       faultSubcode: 
       faultString: java.lang.OutOfMemoryError: Java heap space; nested exception is: 
      	java.lang.OutOfMemoryError: Java heap space
       faultActor: 
       faultNode: 
       faultDetail: 
      	{}faultData:null
      	\{http://xml.apache.org/axis/}hostname:barral
      
      java.lang.OutOfMemoryError: Java heap space; nested exception is: 
      	java.lang.OutOfMemoryError: Java heap space
      	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
      	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
      	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:606)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1741)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
      	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:302)
      	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
      	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
      	at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
      	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
      	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
      	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
      	at org.apache.axis.client.Call.invoke(Call.java:2767)
      	at org.apache.axis.client.Call.invoke(Call.java:2443)
      	at org.apache.axis.client.Call.invoke(Call.java:2366)
      	at org.apache.axis.client.Call.invoke(Call.java:1812)
      	at jenkins.plugins.confluence.soap.v1.ConfluenceserviceV1SoapBindingStub.addAttachment(ConfluenceserviceV1SoapBindingStub.java:4896)
      	at com.myyearbook.hudson.plugins.confluence.ConfluenceSession.addAttachment(ConfluenceSession.java:181)
      	at com.myyearbook.hudson.plugins.confluence.ConfluenceSession.addAttachment(ConfluenceSession.java:201)
      	at com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performAttachments(ConfluencePublisher.java:241)
      	at com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.perform(ConfluencePublisher.java:314)
      	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
      	at hudson.model.Build$BuildExecution.post2(Build.java:183)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
      	at hudson.model.Run.execute(Run.java:1601)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:241)
      

          [JENKINS-18383] Out of memory errors when uploading

          Joe Hansche added a comment -

          Unfortunately, there's not much I can do to fix that. I haven't tried uploading a 25MB file via the plugin. You might need to increase your java heap space given to the Jenkins server. Can you tell what the upward limit is for the attachment in your JVM?

          There's only one way to add an attachment in this API, and if the axis client is unable to attach it within the JVM heap provided, the plugin will not be able to do anything to fix that. From the Confluence documentation, it states:

          Attachment addAttachment(String token, long contentId, Attachment attachment, byte[] attachmentData) - add a new attachment to a content entity object. Note that this uses a lot of memory - about 4 times the size of the attachment. The 'long contentId' is actually a String pageId for XML-RPC.

          Joe Hansche added a comment - Unfortunately, there's not much I can do to fix that. I haven't tried uploading a 25MB file via the plugin. You might need to increase your java heap space given to the Jenkins server. Can you tell what the upward limit is for the attachment in your JVM? There's only one way to add an attachment in this API, and if the axis client is unable to attach it within the JVM heap provided, the plugin will not be able to do anything to fix that. From the Confluence documentation , it states: Attachment addAttachment(String token, long contentId, Attachment attachment, byte[] attachmentData) - add a new attachment to a content entity object. Note that this uses a lot of memory - about 4 times the size of the attachment. The 'long contentId' is actually a String pageId for XML-RPC.

          It did succeed uploading files that were ~15 MB. However, files of 30 MB and more failed uploading. That's why I would say the limit is around 25 MB.

          I've tried increasing the memory allocated to Jenkins to 1280 MB but it didn't change the result.

          If that's something that cannot be fixed, I would suggest adding a warning on the plugin description page so that other users know this should not be used with large files.

          Thanks!

          Alexis Seigneurin added a comment - It did succeed uploading files that were ~15 MB. However, files of 30 MB and more failed uploading. That's why I would say the limit is around 25 MB. I've tried increasing the memory allocated to Jenkins to 1280 MB but it didn't change the result. If that's something that cannot be fixed, I would suggest adding a warning on the plugin description page so that other users know this should not be used with large files. Thanks!

          Joe Hansche added a comment -

          "should not be used with large files" is incorrect, though. If the JVM allows the attachment to be added, it will work. So having the stacktrace showing an error because of OOM shows the Jenkins site administrator that the attachment puts it over its heap limit.

          I could catch the OOME and and show a more friendly error message in the console, but if it's a failure, the stacktrace is probably helpful to have.

          Joe Hansche added a comment - "should not be used with large files" is incorrect, though. If the JVM allows the attachment to be added, it will work. So having the stacktrace showing an error because of OOM shows the Jenkins site administrator that the attachment puts it over its heap limit. I could catch the OOME and and show a more friendly error message in the console, but if it's a failure, the stacktrace is probably helpful to have.

            jhansche Joe Hansche
            seigneurin Alexis Seigneurin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: