Apache Axis 1.4 OutOfMemoryError: Java heap space
I have a peculiar problem that have suddenly appeared on the client side that uses Apache Axis 1.4 to make SOAP requests to a web service. Everything has been running smoothly for a year. The size of the responses have been growing slowly over time, and recently I'm getting rathe开发者_StackOverflowr random OutOfMemoryError: Java heap space
exceptions upon the call. The top part of the trace shown at the bottom. This happens at perhaps 1/10 of the calls made. If it happens and I catch the exception and just try the call again, it works in 99 cases out of 100.
When I first started seeing this, I naturally assumed that my maximum heap size needed to be increased. I'm running Tomcat 6, and changed my previous -Xmx1024M
setting to -Xmx2048M
(there's plenty of RAM on the machine). However, this didn't change anything. Looking at the status of Tomcat, the heap seems to have plenty of space to accomodate the SOAP response. The problem does not seem to be related to PermGen space available either.
The error is not related to the time the application have been running, it can happen immediately upon start of Tomcat. Hence it seems not related to the overall load on the server.
Does anybody have any ideas about this? Am I dealing with a known bug in Axis? I've found a few cases of people getting OutOfMemoryError
exception when sending huge attachments over SOAP, however, this is not what I'm doing.
I'm using wrapped/literal for the SOAP web service.
Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
at org.apache.axis.message.SAX2EventRecorder$objArrayVector.add(SAX2EventRecorder.java:254)
at org.apache.axis.message.SAX2EventRecorder.newElement(SAX2EventRecorder.java:136)
at org.apache.axis.encoding.DeserializationContext.pushNewElement(DeserializationContext.java:769)
at org.apache.axis.message.SOAPHandler.startElement(SOAPHandler.java:94)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
From the look of it, I'd say the problem is not with Axis. Did you try to perform a memory analysis? With a tool like Memory Analyzer Tool (MAT).
精彩评论