打印

Xerces-J 2.6.2之org.apache.xml.serialize.XMLSerializer内存泄漏Bug

Xerces-J 2.6.2之org.apache.xml.serialize.XMLSerializer内存泄漏Bug

关于weblogic中org.apache.xml.serialize.XMLSerializer内存泄漏的问题weblogic

环境:weblogic 922 for aix 5.3 jdk 1.5 sr5b

系统有好几十个server,经常出现各server宕机现象,主要表现为内存泄漏。

经检查,发现系统中出现内存泄漏,泄漏对象为:

One instance of "org.apache.xml.serialize.XMLSerializer" loaded by "com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138" occupies 636,849,888 (60.60%) bytes. The memory is accumulated in one instance of "org.apache.xml.serialize.XMLSerializer" loaded by "com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138".Keywords
com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138
org.apache.xml.serialize.XMLSerializer



Class                                                          Name            Shallow  Heap Retained Heap
org.apache.xml.serialize.XMLSerializer @ 0x98b173b0 Unknown 120 636,849,888
com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138 System Class 104 71,168



Class Name Shallow Heap Retained Heap Percentage
org.apache.xml.serialize.XMLSerializer @ 0x98b173b0 120 636,849,888 60.60%
org.apache.xerces.dom.DeferredElementNSImpl @ 0x8c4b6f18 64 368,273,768 35.05%
java.io.StringWriter @ 0x98b17378 32 268,566,600 25.56%
org.apache.xml.serialize.Printer @ 0x98b17758 40 8,248 0.00%
org.apache.xml.serialize.ElementState[10] @ 0x98b174f0 56 616 0.00%
java.lang.String @ 0x882f1170 32 240 0.00%
java.lang.StringBuffer @ 0x98b17478 24 120 0.00%
org.apache.xml.serialize.OutputFormat @ 0x98b17318 96 96 0.00%
org.apache.xerces.dom.DOMErrorImpl @ 0x98b17428 40 80 0.00%
Total: 8 entries 384 636,849,768 0.606


出现JVM用完时,线程大部分都在运行如下:

SECTION       THREADS subcomponent dump routine
NULL           =================================
NULL            
1XMCURTHDINFO  Current Thread Details
NULL           ----------------------
3XMTHREADINFO      "[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'" (TID:0x35019D00, sys_thread_t:0x35000F60, state:R, native ID:0x00213049) prio=5
4XESTACKTRACE          at java/lang/StringBuffer.ensureCapacityImpl(StringBuffer.java:386(Compiled Code))
4XESTACKTRACE          at java/lang/StringBuffer.append(StringBuffer.java:126(Compiled Code))
4XESTACKTRACE          at java/io/StringWriter.write(StringWriter.java:94(Compiled Code))
4XESTACKTRACE          at java/io/Writer.write(Writer.java:125(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/Printer.printText(Bytecode PC:18(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.printEscaped(Bytecode PC:18(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.printAttribute(Bytecode PC:103(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:269(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))

4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serialize(Bytecode PC:11(Compiled Code))
4XESTACKTRACE          at ygfmis/fw/system/util/xml/YgXml.exportXml(YgXml.java:144(Compiled Code))
4XESTACKTRACE          at ygfmis/fw/system/util/xml/YgXml.getXml(YgXml.java:405(Compiled Code))

4XESTACKTRACE          at ygfmis/fw/system/databus/DataBusUtil.exportDataBusToString(DataBusUtil.java:514)
4XESTACKTRACE          at ygfmis/web/utils/UserExceptionLogProcess.processException(UserExceptionLogProcess.java:106(Compiled Code))
4XESTACKTRACE          at ygfmis/web/servlet/RemoteObjectServlet.doPost(RemoteObjectServlet.java:366(Compiled Code))
4XESTACKTRACE          at javax/servlet/http/HttpServlet.service(HttpServlet.java:763(Compiled Code))
4XESTACKTRACE          at javax/servlet/http/HttpServlet.service(HttpServlet.java:856(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletStubImpl.execute(ServletStubImpl.java:283(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/TailFilter.doFilter(TailFilter.java:26(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at com/ygsoft/security/session/sessionImpl/FMISSessionFilter.doFilter(FMISSessionFilter.java:119(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261(Compiled Code))
4XESTACKTRACE          at com/sun/faces/context/ExternalContextImpl.dispatch(ExternalContextImpl.java:322(Compiled Code))
4XESTACKTRACE          at com/sun/faces/application/ViewHandlerImpl.renderView(ViewHandlerImpl.java:130(Compiled Code))
4XESTACKTRACE          at com/sun/faces/lifecycle/RenderResponsePhase.execute(RenderResponsePhase.java:87(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/core/FmisLifecycleImpl.phase(FmisLifecycleImpl.java:209(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/core/FmisLifecycleImpl.render(FmisLifecycleImpl.java:126(Compiled Code))
4XESTACKTRACE          at javax/faces/webapp/FacesServlet.service(FacesServlet.java:198(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletStubImpl.execute(ServletStubImpl.java:283(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/TailFilter.doFilter(TailFilter.java:26(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at com/ygsoft/security/session/sessionImpl/FMISSessionFilter.doFilter(FMISSessionFilter.java:119(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/filter/SessionInitFilter.doFilter(SessionInitFilter.java:226(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3219(Compiled Code))
4XESTACKTRACE          at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:321(Compiled Code))
4XESTACKTRACE          at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:121(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2002(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:1908(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1362(Compiled Code))
4XESTACKTRACE          at weblogic/work/ExecuteThread.execute(ExecuteThread.java:209(Compiled Code))
4XESTACKTRACE          at weblogic/work/ExecuteThread.run(ExecuteThread.java:181)

One instance of "org.apache.xml.serialize.XMLSerializer" loaded by "com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138" occupies 636,849,888 (60.60%) bytes. The memory is accumulated in one instance of "org.apache.xml.serialize.XMLSerializer" loaded by "com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138".Keywords
com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138
org.apache.xml.serialize.XMLSerializer


Class                                                          Name            Shallow  Heap Retained Heap
org.apache.xml.serialize.XMLSerializer @ 0x98b173b0 Unknown 120 636,849,888
com.ibm.oti.vm.BootstrapClassLoader @ 0x70019138 System Class 104 71,168


Class Name Shallow Heap Retained Heap Percentage
org.apache.xml.serialize.XMLSerializer @ 0x98b173b0 120 636,849,888 60.60%
org.apache.xerces.dom.DeferredElementNSImpl @ 0x8c4b6f18 64 368,273,768 35.05%
java.io.StringWriter @ 0x98b17378 32 268,566,600 25.56%
org.apache.xml.serialize.Printer @ 0x98b17758 40 8,248 0.00%
org.apache.xml.serialize.ElementState[10] @ 0x98b174f0 56 616 0.00%
java.lang.String @ 0x882f1170 32 240 0.00%
java.lang.StringBuffer @ 0x98b17478 24 120 0.00%
org.apache.xml.serialize.OutputFormat @ 0x98b17318 96 96 0.00%
org.apache.xerces.dom.DOMErrorImpl @ 0x98b17428 40 80 0.00%
Total: 8 entries 384 636,849,768 0.606


出现JVM用完时,线程大部分都在运行如下:

SECTION       THREADS subcomponent dump routine
NULL           =================================
NULL            
1XMCURTHDINFO  Current Thread Details
NULL           ----------------------
3XMTHREADINFO      "[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'" (TID:0x35019D00, sys_thread_t:0x35000F60, state:R, native ID:0x00213049) prio=5
4XESTACKTRACE          at java/lang/StringBuffer.ensureCapacityImpl(StringBuffer.java:386(Compiled Code))
4XESTACKTRACE          at java/lang/StringBuffer.append(StringBuffer.java:126(Compiled Code))
4XESTACKTRACE          at java/io/StringWriter.write(StringWriter.java:94(Compiled Code))
4XESTACKTRACE          at java/io/Writer.write(Writer.java:125(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/Printer.printText(Bytecode PC:18(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.printEscaped(Bytecode PC:18(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.printAttribute(Bytecode PC:103(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:269(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/XMLSerializer.serializeElement(Bytecode PC:1742(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serializeNode(Bytecode PC:749(Compiled Code))
4XESTACKTRACE          at org/apache/xml/serialize/BaseMarkupSerializer.serialize(Bytecode PC:11(Compiled Code))
4XESTACKTRACE          at ygfmis/fw/system/util/xml/YgXml.exportXml(YgXml.java:144(Compiled Code))
4XESTACKTRACE          at ygfmis/fw/system/util/xml/YgXml.getXml(YgXml.java:405(Compiled Code))
4XESTACKTRACE          at ygfmis/fw/system/databus/DataBusUtil.exportDataBusToString(DataBusUtil.java:514)
4XESTACKTRACE          at ygfmis/web/utils/UserExceptionLogProcess.processException(UserExceptionLogProcess.java:106(Compiled Code))
4XESTACKTRACE          at ygfmis/web/servlet/RemoteObjectServlet.doPost(RemoteObjectServlet.java:366(Compiled Code))
4XESTACKTRACE          at javax/servlet/http/HttpServlet.service(HttpServlet.java:763(Compiled Code))
4XESTACKTRACE          at javax/servlet/http/HttpServlet.service(HttpServlet.java:856(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletStubImpl.execute(ServletStubImpl.java:283(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/TailFilter.doFilter(TailFilter.java:26(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at com/ygsoft/security/session/sessionImpl/FMISSessionFilter.doFilter(FMISSessionFilter.java:119(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261(Compiled Code))
4XESTACKTRACE          at com/sun/faces/context/ExternalContextImpl.dispatch(ExternalContextImpl.java:322(Compiled Code))
4XESTACKTRACE          at com/sun/faces/application/ViewHandlerImpl.renderView(ViewHandlerImpl.java:130(Compiled Code))
4XESTACKTRACE          at com/sun/faces/lifecycle/RenderResponsePhase.execute(RenderResponsePhase.java:87(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/core/FmisLifecycleImpl.phase(FmisLifecycleImpl.java:209(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/core/FmisLifecycleImpl.render(FmisLifecycleImpl.java:126(Compiled Code))
4XESTACKTRACE          at javax/faces/webapp/FacesServlet.service(FacesServlet.java:198(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletStubImpl.execute(ServletStubImpl.java:283(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/TailFilter.doFilter(TailFilter.java:26(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at com/ygsoft/security/session/sessionImpl/FMISSessionFilter.doFilter(FMISSessionFilter.java:119(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at ygfmis/jsf/filter/SessionInitFilter.doFilter(SessionInitFilter.java:226(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:42(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3219(Compiled Code))
4XESTACKTRACE          at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:321(Compiled Code))
4XESTACKTRACE          at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:121(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2002(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:1908(Compiled Code))
4XESTACKTRACE          at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1362(Compiled Code))
4XESTACKTRACE          at weblogic/work/ExecuteThread.execute(ExecuteThread.java:209(Compiled Code))
4XESTACKTRACE          at weblogic/work/ExecuteThread.run(ExecuteThread.java:181)

根据线程执行情况,找出进行XML解析之前的操作:
try {
      serial.asDOMSerializer();
      serial.serialize((Element)node);
    } catch (Exception e) {
      if (log.isErrorEnabled()) {
根据内存泄漏点,找出org.apache.xml.serialize.XMLSerializer类的代码jar文件为:xercesImpl.jar

版本为:
Name: org/apache/xerces/impl/Version.class
Implementation-Title: org.apache.xerces.impl.Version
Comment: Xerces-J 2.6.2
Implementation-Version: 2.6.2
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/xerces2-j/

这文件是一个第三方的XML解析包,经到官方上查看相关信息,在Xerces-J 2.9.1版本中已经解决了这个因“Element”问题引起的内存泄漏。
经在系统中更换新版的xml解析包后,内存泄漏问题解决。

更新bug列表如下:
Xerces-J 2.9.1         
        This release fixes several bugs which were present in Xerces-J 2.9.0. It also includes a few minor enhancements and performance improvements.
•         Added support for creating UIEvents and MouseEvents through the DOM Level 2 Events API. [Michael Glavassevich]
•         Improved the reporting of character conversion errors. The CharConversionException which triggered the fatal error is now available from SAXException.getException(). [Michael Glavassevich]
•         Reduced the performance penalty for using an EOFException internally to signal to the scanner that the end of the document has been reached. The exception is now cached, avoiding the expensive fillInStackTrace() on creation. [Michael Glavassevich]
•         Improved the performance of the XMLGregorianCalendar implementation. [Michael Glavassevich]

•        Implemented improvements in the processing of large minOccurs/maxOccurs on element/wildcard particles which once caused OutOfMemoryErrors to occur during validation. Note that an OutOfMemoryError may still occur if the minOccurs/maxOccurs are nested or appear on a sequence or choice model group. [Michael Glavassevich]

•         Improved the algorithm for checking the Unique Particle Attribution constraint so that it no longer causes an OutOfMemoryError for content models with large maxOccurs values. Note that this only applies to the checking of schema validity. An OutOfMemoryError may still occur if the schema contains large maxOccurs and is used to validate an instance document. [Peter McCracken]
•         Completed the implementation of XML Schema erratum E2-67. [Ed Merks, Khaled Noaman]
•         Implemented XML 1.0 Third Edition erratum E13. [Michael Glavassevich]
•         Fixed bugs in the implementation of Document.normalizeDocument() where it was not correctly re-evaluating Element.schemaTypeInfo, Attr.schemaTypeInfo, IDness or the [element content whitespace] property of text nodes when validating against a DTD or XML Schema. [Michael Glavassevich]
•         Fixed a thread-safety bug which could cause an ArrayIndexOutOfBoundsException or a NullPointerException to be thrown during DTD validation if a grammar pool is shared between multiple parser instances. [Michael Glavassevich]
•         Fixed a bug in the DOMConfiguration of a Document where it was processing the "schema-location" parameter as an atomic URI value instead of a whitespace separated list of URIs. [Michael Glavassevich]
•         Fixed a bug in the XInclude implementation where the Locator would report the location of the xi:include element in the top-level document as the location of all the document events in the included document or fragment. [Michael Glavassevich]
•         Fixed a bug in the JAXP schema validator which caused it to fail with a third-party DOM Level 3 implementation whose nodes can only be tested for identity using isSameNode(). [Michael Glavassevich]
•         Fixed several bugs in the XML schema processor which were exposed by running the W3C's XML Schema 1.0 2nd Edition test suite. [Michael Glavassevich]
•         Fixed several bugs in the DOM Level 2 Traversal and Range implementation. [Michael Glavassevich]
•         Fixed various bugs and made various improvements. [Dave Brosius, Michael Glavassevich, Khaled Noaman]
本帖最近评分记录
  • Java2Class 威望 +2 周林铃 23:17:23 哦,这种情况最后你怎么处理 ... 2010-5-4 10:39

TOP