I suspect the source of this problem is either something low level in the 
jetty HttpClient cleanup code ( which Solr should should already be 
correctly cleaning up on Http2SolrClient.close() ) or it's some nuance of 
how your 'createSolrClient()' method is impleemnted that creates an edge 
case preventing 'Http2SolrClient.close()' from doing a full cleanup of the 
underlying HttpClient.

can you please share the details of createSolrClient() ?

To answer your followup question: SolrClient instances are designed to be 
threadsafe and re-used by multiple concurrent threads making concurrent 
requests ... but that doesn't mean there should be memory leaks if you use 
it the way you are.


-Hoss
http://www.lucidworks.com/


: time - I switched to Http2SolrClient since the other was marked deprecated.
: We use the client in the pattern ...
: 
: try (SolrClient client =  createSolrClient()) {
:   response = client.query(solrQuery);
:   // do stuff with response
: }
: 
: Which should  auto close the client to clean things up. But we've noticed
: on tomcat shutdown this error in the logs ...
        ...
: Even worse, in another environment when left up long enough with lots or
: queries ...  we eventually noticed an OutOfMemory error due to all the
: ThreadLocal's which do not seem to be cleaned up.

Reply via email to