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

Chad Juliano edited comment on AVRO-1595 at 4/24/19 10:17 PM:
--------------------------------------------------------------

I have a service that was running out of memory. I generated some activity in 
the service while monitoring in VisualVM. With each request I saw almost 
everything was GC'd except RESOLVER_CACHE which kept on growing because my Avro 
schemas are dynamic.

I had an ExecutorService that was keeping a pool of threads which would hold on 
to the RESOLVER_CACHE even after the threads finished. I was able to work 
around the issue by doing a shutdown() and creating a new thread pool with each 
request. When the threads got finalized the ThreadLocal data was GC'd. 

Creating new thread pools is not a problem in my case but it could be for 
someone else.


was (Author: cjuliano):
I have a service that was running out of memory. I generated some activity in 
the service while monitoring in VisualVM. With each request I saw almost 
everything was GC'd except RESOLVER_CACHE which kept on growing because my Avro 
schemas are dynamic.

 

I had an ExecutorService that was keeping a pool of threads which would hold on 
to the RESOLVER_CACHE even after the threads finished. I was able to work 
around the issue by doing a shutdown() and creating a new thread pool with each 
request. When the threads got finalized the ThreadLocal data was GC'd. 

Creating new thread pools is not a problem in my case but it could be for 
someone else.

> 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)

Reply via email to