You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Chad Juliano (JIRA)" <ji...@apache.org> on 2019/04/23 22:29:00 UTC

[jira] [Commented] (AVRO-1595) Give access to remove threadlocal values

    [ https://issues.apache.org/jira/browse/AVRO-1595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824606#comment-16824606 ] 

Chad Juliano commented on AVRO-1595:
------------------------------------

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)