Memory Issue
Added by Sathya Selva over 3 years ago
I created the web services for Saxon transformation and hosted in tomcat with maximum heap size 4gb. I'm keep on getting heap space error in tomcat, I got log from tomcat and analyze the log with MAT
at net.sf.saxon.tree.tiny.TinyNodeImpl.iterateAxis(BLnet/sf/saxon/pattern/NodeTest;)Lnet/sf/saxon/tree/iter/AxisIterator; (TinyNodeImpl.java:499)
at net.sf.saxon.tree.util.Navigator.getNumberAny(Lnet/sf/saxon/expr/Expression;Lnet/sf/saxon/om/NodeInfo;Lnet/sf/saxon/pattern/Pattern;Lnet/sf/saxon/pattern/Pattern;Lnet/sf/saxon/expr/XPathContext;Z)I (Navigator.java:564)
at net.sf.saxon.expr.instruct.NumberInstruction.iterate(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/SequenceIterator; (NumberInstruction.java:247)
at net.sf.saxon.expr.NumberSequenceFormatter.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/value/StringValue; (NumberSequenceFormatter.java:234)
at net.sf.saxon.expr.NumberSequenceFormatter.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item; (NumberSequenceFormatter.java:37)
at net.sf.saxon.expr.CastExpression.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/value/AtomicValue; (CastExpression.java:392)
at net.sf.saxon.expr.CastExpression.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item; (CastExpression.java:30)
at net.sf.saxon.expr.parser.Evaluator$5.evaluate(Lnet/sf/saxon/expr/Expression;Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item; (Evaluator.java:191)
at net.sf.saxon.expr.parser.Evaluator$5.evaluate(Lnet/sf/saxon/expr/Expression;Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Sequence; (Evaluator.java:188)
at net.sf.saxon.expr.LetExpression.eval(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Sequence; (LetExpression.java:531)
at net.sf.saxon.expr.LetExpression.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (LetExpression.java:712)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(Lnet/sf/saxon/expr/XPathContext;Z)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:300)
at net.sf.saxon.expr.instruct.ApplyTemplates.process(Lnet/sf/saxon/expr/XPathContext;)V (ApplyTemplates.java:251)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;Lnet/sf/saxon/om/NodeInfo;)Lnet/sf/saxon/expr/instruct/TailCall; (ElementCreator.java:352)
at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Copy.java:425)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(Lnet/sf/saxon/expr/XPathContext;Z)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:300)
at net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:255)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Block.java:735)
at net.sf.saxon.expr.instruct.Instruction.process(Lnet/sf/saxon/expr/XPathContext;)V (Instruction.java:132)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;Lnet/sf/saxon/om/NodeInfo;)Lnet/sf/saxon/expr/instruct/TailCall; (ElementCreator.java:352)
at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Copy.java:425)
at net.sf.saxon.expr.LetExpression.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (LetExpression.java:721)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(Lnet/sf/saxon/expr/XPathContext;Z)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:300)
at net.sf.saxon.expr.instruct.ApplyTemplates.process(Lnet/sf/saxon/expr/XPathContext;)V (ApplyTemplates.java:251)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;Lnet/sf/saxon/om/NodeInfo;)Lnet/sf/saxon/expr/instruct/TailCall; (ElementCreator.java:352)
at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Copy.java:425)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(Lnet/sf/saxon/expr/XPathContext;Z)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:300)
at net.sf.saxon.expr.instruct.ApplyTemplates.process(Lnet/sf/saxon/expr/XPathContext;)V (ApplyTemplates.java:251)
at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;Lnet/sf/saxon/om/NodeInfo;)Lnet/sf/saxon/expr/instruct/TailCall; (ElementCreator.java:352)
at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Copy.java:425)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.trans.rules.TextOnlyCopyRuleSet.process(Lnet/sf/saxon/om/Item;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContext;Lnet/sf/saxon/expr/parser/Location;)V (TextOnlyCopyRuleSet.java:71)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:495)
at net.sf.saxon.expr.instruct.ApplyTemplates.apply(Lnet/sf/saxon/expr/XPathContext;Z)Lnet/sf/saxon/expr/instruct/TailCall; (ApplyTemplates.java:300)
at net.sf.saxon.expr.instruct.ApplyTemplates.process(Lnet/sf/saxon/expr/XPathContext;)V (ApplyTemplates.java:251)
at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/NodeInfo; (DocumentInstr.java:310)
at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item; (DocumentInstr.java:46)
at net.sf.saxon.expr.parser.Evaluator$5.evaluate(Lnet/sf/saxon/expr/Expression;Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item; (Evaluator.java:191)
at net.sf.saxon.expr.parser.Evaluator$5.evaluate(Lnet/sf/saxon/expr/Expression;Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Sequence; (Evaluator.java:188)
at net.sf.saxon.expr.LetExpression.eval(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Sequence; (LetExpression.java:531)
at net.sf.saxon.expr.LetExpression.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (LetExpression.java:712)
at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (Choose.java:896)
at net.sf.saxon.expr.LetExpression.processLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (LetExpression.java:721)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/expr/instruct/TailCall; (TemplateRule.java:352)
at net.sf.saxon.trans.Mode.applyTemplates(Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/instruct/ParameterSet;Lnet/sf/saxon/expr/XPathContextMajor;Lnet/sf/saxon/expr/parser/Location;)Lnet/sf/saxon/expr/instruct/TailCall; (Mode.java:532)
at net.sf.saxon.trans.XsltController.applyTemplates(Lnet/sf/saxon/om/Sequence;Lnet/sf/saxon/event/Receiver;)V (XsltController.java:747)
at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(Ljavax/xml/transform/Source;Lnet/sf/saxon/event/Receiver;)V (AbstractXsltTransformer.java:347)
at net.sf.saxon.s9api.XsltTransformer.transform()V (XsltTransformer.java:349)
at com.sps.Wileyxsl.s9ApiXsltTransformer(Ljavax/xml/transform/Source;Ljavax/servlet/http/HttpServletResponse;)Ljava/lang/String; (Wileyxsl.java:157)
at com.sps.Wileyxsl.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V (Wileyxsl.java:81)
at javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V (HttpServlet.java:652)
at javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V (HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V (ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V (ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V (WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V (ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V (ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V (StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V (CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Lorg/apache/tomcat/util/net/SocketWrapperBase;)Lorg/apache/tomcat/util/net/AbstractEndpoint$Handler$SocketState; (Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(Lorg/apache/tomcat/util/net/SocketWrapperBase;Lorg/apache/tomcat/util/net/SocketEvent;)Lorg/apache/tomcat/util/net/AbstractEndpoint$Handler$SocketState; (AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Lorg/apache/tomcat/util/net/SocketWrapperBase;Lorg/apache/tomcat/util/net/SocketEvent;)Lorg/apache/tomcat/util/net/AbstractEndpoint$Handler$SocketState; (AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun()V (NioEndpoint.java:1590)
at org.apache.tomcat.util.net.SocketProcessorBase.run()V (SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run()V (ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run()V (TaskThread.java:61)
at java.lang.Thread.run()V (Thread.java:748)
Please give some advice about this or how to fix this issue
Thanks
Replies (1)
RE: Memory Issue - Added by Michael Kay over 3 years ago
It's failed in xsl:number level="any". This instruction uses a cache to avoid each call on xsl:number having to search the entire document. I guess that if the document is large, this cache could grow to a significant size. But there are probably other significant contributors to the memory usage too - it just happens that this is the straw that broke the camel's back.
If you have a heap dump, it would be useful to know which objects/classes are occupying the most memory.
And of course it would be useful to have some information on the workload, e.g. are you processing lots of small documents, one large document, etc.
If it's one large document, then you should consider a streaming solution.
Please register to reply