Aleksandr Dubinsky created TIKA-1784:
----------------------------------------
Summary: Use of ThreadLocal in Tika causes memory leaks and
warnings in Tomcat
Key: TIKA-1784
URL: https://issues.apache.org/jira/browse/TIKA-1784
Project: Tika
Issue Type: Bug
Components: parser
Affects Versions: 1.11
Reporter: Aleksandr Dubinsky
Priority: Minor
Please see this SO discussion:
https://stackoverflow.com/questions/13852632/is-it-really-my-job-to-clean-up-threadlocal-resources-when-classes-have-been-exp
The problem with ThreadLocals is not only do they leak memory in themselves,
they actually cause the ClassLoader to stay around and consume permgen.
Some of the warnings I get are:
- The web application [ROOT] created a ThreadLocal with key of type
[org.apache.poi.extractor.ExtractorFactory$1] (value
[org.apache.poi.extractor.ExtractorFactory$1@180f70ad]) and a value of type
[java.lang.Boolean] (value [true]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to try and
avoid a probable memory leak.
- The web application [ROOT] created a ThreadLocal with key of type
[org.apache.xmlbeans.impl.store.CharUtil$1] (value
[org.apache.xmlbeans.impl.store.CharUtil$1@4d017bd6]) and a value of type
[java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@41099238])
but failed to remove it when the web application was stopped. Threads are going
to be renewed over time to try and avoid a probable memory leak.
- The web application [ROOT] created a ThreadLocal with key of type
[org.apache.xmlbeans.impl.store.Locale$1] (value
[org.apache.xmlbeans.impl.store.Locale$1@44b3ad91]) and a value of type
[java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@3e2af6cd])
but failed to remove it when the web application was stopped. Threads are going
to be renewed over time to try and avoid a probable memory leak.
- The web application [ROOT] created a ThreadLocal with key of type
[org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$SchemaTypeLoaderCache$1]
(value
[org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$SchemaTypeLoaderCache$1@36c8b20c])
and a value of type [java.util.ArrayList] (value
[[java.lang.ref.SoftReference@2525342a]]) but failed to remove it when the web
application was stopped. Threads are going to be renewed over time to try and
avoid a probable memory leak.
- The web application [ROOT] created a ThreadLocal with key of type
[org.apache.xmlbeans.XmlBeans$1] (value
[org.apache.xmlbeans.XmlBeans$1@67e0d2e5]) and a value of type
[java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@79e0607a])
but failed to remove it when the web application was stopped. Threads are going
to be renewed over time to try and avoid a probable memory leak.
I see that most of the warnings are actually emitted by xmlbeans, but since I'm
not knowledgeable about how Tika uses that library or what can be done about
it, I'll start the blame chain here and let it trickle down.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)