Elasticsearch connection close issue

Hi

Im using 7.10.2 and I have closed Elasticsearch Client while stopping application as below.

   @PreDestroy
    public void onShutdown(){
		getEsClient().shutdownES();
	     
       
    }

But Still Im getting below error in logs while stopping application

Jan 27, 2022 5:52:45 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [amdashboard] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@54dc72ea]) and a value of type [org.elasticsearch.common.util.concurrent.ThreadContext.ThreadContextStruct] (value [org.elasticsearch.common.util.concurrent.ThreadContext$ThreadContextStruct@3bb6972a]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Jan 27, 2022 5:52:45 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [amdashboard] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2cc43f8a]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@5c168f93]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Jan 27, 2022 5:52:45 PM org.apache.coyote.AbstractProtocol stop

Can someone please update?

Can someone please update?

Hey,

the shutdownES() method does not exist in the Elasticsearch client - where does it come from?

--Alex

Its my method. Inside that I call client.close()

Which client are you using exactly? This sounds like a bug, but I think it can only happen if you're using something deprecated. If so, a fix is unlikely, the solution would be to move to a client that isn't deprecated.

Im using 7.10.2 with below code to open and close client

import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;

Client esClient = new TransportClient()
						.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"),9300));
    	esClient.close();

That confirms it, you're using a deprecated client.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.