Uploaded image for project: 'Confluence Server'
  1. Confluence Server
  2. CONFSERVER-23645

OutOfMemoryError with Remote API addAttachment service

    XMLWordPrintable

    Details

    • Symptom Severity:
      Severity 2 - Major
    • UIS:
      1
    • Support reference count:
      5

      Description

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Confluence CLI is being used, but it doesn't do much other than call the addAttachment Remote API service. The documentation says:

      Note that this uses a lot of memory - about 4 times the size of the attachment.

      Can attach files around 3 MBs, but problems when larger files. 13 MBs fails (see https://studio.plugins.atlassian.com/browse/CSOAP-114). I attempted 23 MBs with a 4GB java heap size. Same file can be attached via UI fine.

      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:601)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
      	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
      	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 org.swift.common.soap.confluence.ConfluenceserviceV2SoapBindingStub.addAttachment(ConfluenceserviceV2SoapBindingStub.java:4857)
      	at org.swift.confluence.cli.ConfluenceClient.addAttachment(ConfluenceClient.java:1707)
      	at org.swift.confluence.cli.ConfluenceClient.addAttachment(ConfluenceClient.java:1646)
      	at org.swift.confluence.cli.ConfluenceClient.handleRequest(ConfluenceClient.java:471)
      	at org.swift.common.cli.AbstractRemoteClient.process(AbstractRemoteClient.java:119)
      	at org.swift.common.cli.CliClient.doWork(CliClient.java:225)
      	at org.swift.confluence.cli.ConfluenceClient.main(ConfluenceClient.java:115)
      

      Workaround

      • Attach the file through Confluence interface
      • Use "doattachfile.action" controller using a tool like curl, so your command line would look like:
      curl -F file_0=@<path to file> -F pageId=<confluence page id> -u <username>:<password> "http://Confluence-URL/pages/doattachfile.action"
      

      or,

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                10 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Last commented:
                  3 years, 8 weeks ago