[
https://issues.apache.org/jira/browse/AVRO-1595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824606#comment-16824606
]
Chad Juliano edited comment on AVRO-1595 at 4/23/19 10:31 PM:
--------------------------------------------------------------
I second that. There is a threadLocal cache in GenericDatumReader that keeps
growing with each new schema. If schemas are dynamically generated then the
process will eventually run out of memory.
[https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java#L106]
{{private static final ThreadLocal<Map<Schema,Map<Schema,ResolvingDecoder>>>
RESOLVER_CACHE = new ThreadLocal<Map<Schema,Map<Schema,ResolvingDecoder>>>() {
protected Map<Schema,Map<Schema,ResolvingDecoder>> initialValue()}}{{{ return
new WeakIdentityHashMap<Schema,Map<Schema,ResolvingDecoder>>(); }}}{{};}}
This is also a classloader leak that causes problems for web servers.
was (Author: cjuliano):
I second that. There is a threadLocal cache in GenericDatumReader that keeps
growing with each new schema. If schemas are dynamically generated then the
process will eventually run out of memory.
[https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java#L106]
{{ private static final ThreadLocal<Map<Schema,Map<Schema,ResolvingDecoder>>>
RESOLVER_CACHE = new ThreadLocal<Map<Schema,Map<Schema,ResolvingDecoder>>>() {
protected Map<Schema,Map<Schema,ResolvingDecoder>> initialValue()
{ return new WeakIdentityHashMap<Schema,Map<Schema,ResolvingDecoder>>(); }
};}}
This is also a classloader leak that causes problems for web servers.
> Give access to remove threadlocal values
> ----------------------------------------
>
> Key: AVRO-1595
> URL: https://issues.apache.org/jira/browse/AVRO-1595
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Reporter: Bryan Baugher
> Priority: Minor
>
> Certain JVM containers like tomcat re-use threads when re-deploying
> applications which can leave behind threadlocal values. It would be great if
> there were something that could be called on shutdown to remove these.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)