# ES - ThreadLocal's hanging around

**URL:** <https://discuss.elastic.co/t/es-threadlocals-hanging-around/6001>\
**Category:** Elasticsearch\
**Created:** [November 28, 2011, 9:35pm UTC](https://discuss.elastic.co/t/es-threadlocals-hanging-around/6001 "2011-11-28T21:35:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [November 28, 2011, 9:35pm UTC](https://discuss.elastic.co/t/es-threadlocals-hanging-around/6001/1 "2011-11-28T21:35:36Z")

</div>

I get the error below running 0.18.3 in windows under Tomcat 7.0.14 and  
Java 1.6.0\_25.

SEVERE: The web application [/viewer] created a ThreadLocal with key of  
type [or  
g.elasticsearch.search.internal.InternalSearchHits$1] (value  
[org.elasticsearch.  
search.internal.InternalSearchHits$1@5f9d8d47]) and a value of type  
[org.elastic  
search.common.thread.ThreadLocals.CleanableValue] (value  
[org.elasticsearch.comm  
on.thread.ThreadLocals$CleanableValue@3786238a]) but failed to remove it  
when th  
e web application was stopped. Threads are going to be renewed over time  
to try  
and avoid a probable memory leak.

It is produced when I redeploy my webapp. Is there anything that I could be  
doing in my code to produce this or is this ES internal? I'm pretty sure  
there are no SearchHits objects being assigned to a ThreadLocal in my app.

Thanks in advance,  
--Mike

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 29, 2011, 7:53am UTC](https://discuss.elastic.co/t/es-threadlocals-hanging-around/6001/2 "2011-11-29T07:53:39Z")

</div>

Are you closing the node / client you start in your webapp when it gest  
undeployed?

On Mon, Nov 28, 2011 at 11:35 PM, Michael Sick \<  
[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:

> I get the error below running 0.18.3 in windows under Tomcat 7.0.14 and  
> Java 1.6.0\_25.
> 
> SEVERE: The web application [/viewer] created a ThreadLocal with key of  
> type [or  
> g.elasticsearch.search.internal.InternalSearchHits$1] (value  
> [org.elasticsearch.  
> search.internal.InternalSearchHits$1@5f9d8d47]) and a value of type  
> [org.elastic  
> search.common.thread.ThreadLocals.CleanableValue] (value  
> [org.elasticsearch.comm  
> on.thread.ThreadLocals$CleanableValue@3786238a]) but failed to remove it  
> when th  
> e web application was stopped. Threads are going to be renewed over time  
> to try  
> and avoid a probable memory leak.
> 
> It is produced when I redeploy my webapp. Is there anything that I could  
> be doing in my code to produce this or is this ES internal? I'm pretty sure  
> there are no SearchHits objects being assigned to a ThreadLocal in my app.
> 
> Thanks in advance,  
> --Mike

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:47am UTC](https://discuss.elastic.co/t/es-threadlocals-hanging-around/6001/3 "2017-07-06T03:47:09Z")

</div>


