Discussion:
[jira] [Commented] (XALANJ-2195) Memory leak in XMLReaderManager
Srdan Srepfler (JIRA)
2015-03-13 12:12:38 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14360257#comment-14360257 ]

Srdan Srepfler commented on XALANJ-2195:
----------------------------------------

Can this be triggered by a SAXParseException as well? I see 2.7.2 is the latest Xalan, any chance it solved this issue?
example: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1d".
Memory leak in XMLReaderManager
-------------------------------
Key: XALANJ-2195
URL: https://issues.apache.org/jira/browse/XALANJ-2195
Project: XalanJ2
Issue Type: Bug
Components: Xalan
Affects Versions: 2.7
Reporter: Marko Strukelj
Priority: Blocker
Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
In class org.apache.xml.utils.XMLReaderManager
getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
m_readers.set(null);
I wonder, why is reader stored in ThreadLocal in the first place?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Srdan Srepfler (JIRA)
2015-03-13 12:12:39 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14360257#comment-14360257 ]

Srdan Srepfler edited comment on XALANJ-2195 at 3/13/15 12:12 PM:
------------------------------------------------------------------

Can this be triggered by a SAXParseException as well? I see 2.7.2 is the latest Xalan, any chance it solved this issue?
example: {code}org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1d".{code}




was (Author: schrepfler):
Can this be triggered by a SAXParseException as well? I see 2.7.2 is the latest Xalan, any chance it solved this issue?
example: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1d".
Memory leak in XMLReaderManager
-------------------------------
Key: XALANJ-2195
URL: https://issues.apache.org/jira/browse/XALANJ-2195
Project: XalanJ2
Issue Type: Bug
Components: Xalan
Affects Versions: 2.7
Reporter: Marko Strukelj
Priority: Blocker
Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
In class org.apache.xml.utils.XMLReaderManager
getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
m_readers.set(null);
I wonder, why is reader stored in ThreadLocal in the first place?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Rohit Singh (JIRA)
2015-12-14 05:06:46 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15055416#comment-15055416 ]

Rohit Singh commented on XALANJ-2195:
-------------------------------------

I am facing this issue in xalan-2.7.2 also. I found a patch for this issue https://issues.jboss.org/browse/JBPAPP-7093: https://issues.jboss.org/secure/attachment/12346686/xalan-j2-XALANJ-2195.patch-v2
here at http://jira.xwiki.org/browse/XWIKI-9734

This worked for me. Please check-in this patch and release the SNAPSHOT or new one.

Rgrds,Rohit
Memory leak in XMLReaderManager
-------------------------------
Key: XALANJ-2195
URL: https://issues.apache.org/jira/browse/XALANJ-2195
Project: XalanJ2
Issue Type: Bug
Components: Xalan
Affects Versions: 2.7
Reporter: Marko Strukelj
Priority: Blocker
Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
In class org.apache.xml.utils.XMLReaderManager
getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
m_readers.set(null);
I wonder, why is reader stored in ThreadLocal in the first place?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Dmitry Katsubo (JIRA)
2016-06-14 17:37:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15329988#comment-15329988 ]

Dmitry Katsubo commented on XALANJ-2195:
----------------------------------------

It's pity that the issue has been reported in 2005, and in 2016 still not in Xalan (I have checked [v2.7.2|http://grepcode.com/file/repo1.maven.org/maven2/xalan/xalan/2.7.2/org/apache/xml/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29]). What is more painful: build-in [JDK 7.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] and [JDK 8.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] Xerces are also affected by the problem.
Memory leak in XMLReaderManager
-------------------------------
Key: XALANJ-2195
URL: https://issues.apache.org/jira/browse/XALANJ-2195
Project: XalanJ2
Issue Type: Bug
Components: Xalan
Affects Versions: 2.7
Reporter: Marko Strukelj
Priority: Blocker
Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
In class org.apache.xml.utils.XMLReaderManager
getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
m_readers.set(null);
I wonder, why is reader stored in ThreadLocal in the first place?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Dmitry Katsubo (JIRA)
2016-06-14 18:19:27 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15329988#comment-15329988 ]

Dmitry Katsubo edited comment on XALANJ-2195 at 6/14/16 6:18 PM:
-----------------------------------------------------------------

It's pity that the issue has been reported in 2005, and in 2016 still not in Xalan (I have checked [v2.7.2|http://grepcode.com/file/repo1.maven.org/maven2/xalan/xalan/2.7.2/org/apache/xml/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29]). What is more painful: build-in [JDK 7.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] and [JDK 8.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] Xalan is also affected by the problem.


was (Author: dma_k):
It's pity that the issue has been reported in 2005, and in 2016 still not in Xalan (I have checked [v2.7.2|http://grepcode.com/file/repo1.maven.org/maven2/xalan/xalan/2.7.2/org/apache/xml/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29]). What is more painful: build-in [JDK 7.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] and [JDK 8.40|http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java#XMLReaderManager.releaseXMLReader%28org.xml.sax.XMLReader%29] Xerces are also affected by the problem.
Memory leak in XMLReaderManager
-------------------------------
Key: XALANJ-2195
URL: https://issues.apache.org/jira/browse/XALANJ-2195
Project: XalanJ2
Issue Type: Bug
Components: Xalan
Affects Versions: 2.7
Reporter: Marko Strukelj
Priority: Blocker
Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
In class org.apache.xml.utils.XMLReaderManager
getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
m_readers.set(null);
I wonder, why is reader stored in ThreadLocal in the first place?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org

Loading...