Weblogic ThreadLocal Memory leaks using AgileAPI in a web application inside tomcat

We are facing issues in all web application inside tomcat that create an Agile Session using AgileAPI.

deploying to tomcat a web application without any other class but just the simple listener attached below:

public class ResourceManagerListener implements ServletContextListener {

private IAgileSession session;

@Override
public void contextInitialized(ServletContextEvent sce) {
System.out.println(“opening session”);
HashMap<Integer,String> params = new HashMap<Integer, String>();
AgileSessionFactory instance = AgileSessionFactory.getInstance(“http://myserver:7001/Agile”);
params.put(AgileSessionFactory.USERNAME, “username”);
params.put(AgileSessionFactory.PASSWORD, “password”);
session = instance.createSession(params);
}

@Override
public void contextDestroyed(ServletContextEvent sce) {
session.close();
System.out.println(“session closed”);
}

when the web application is reloaded the session is closed properly but the following local thread leaks are logged by Tomcat

SEVERE: The web application [MyWebApp] created a ThreadLocal with key of type [com.agile.api.common.Security$1] (value [com.agile.api.common.Security$1@1c6d5e6]) and a value of type (value [false]) 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.
SEVERE: The web application [MyWebApp] created a ThreadLocal with key of type [weblogic.kernel.ResettableThreadLocal$1] (value [weblogic.kernel.ResettableThreadLocal$1@1051a02]) and a value of type [weblogic.kernel.ResettableThreadLocal.ThreadStorage] (value [weblogic.kernel.ResettableThreadLocal$ThreadStorage@1ee8b44]) 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.
SEVERE: The web application [MyWebApp] created a ThreadLocal with key of type [weblogic.kernel.ResettableThreadLocal$1] (value [weblogic.kernel.ResettableThreadLocal$1@1051a02]) and a value of type [weblogic.kernel.ResettableThreadLocal.ThreadStorage] (value [weblogic.kernel.ResettableThreadLocal$ThreadStorage@1f92fca]) 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.

The local threads created and related leaks, increases during web application life. After two or three reload of the web application, Tomcat goes in PermGenSpace.

Is there a way using AgileAPI or configuring Weblogic server to close these EJB ThreadLocal before shutting down the web application?

in OTN was submitted the bug 23204821 about it but I would like to know if someone found a workaround for this problem
Thank You

No Files Were Attached
Antonio Agile Angel Asked on May 12, 2016 in Other APIs.
Add Comment
2 Answer(s)

what is the version of weblogic used, looks like bug in weblogic.

meanwhile,  Import wlsauth jar, if any security is causing adhoc closure of thread.
Also, Increase tomcat memory.

Paritosh Deshmukh Agile Angel Answered on May 12, 2016.
Add Comment

We’re facing the same issue:

org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [/webapp] created a ThreadLocal with key of type [weblogic.kernel.ResettableThreadLocal$1] (value [weblogic.kernel.ResettableThreadLocal$1@501bf5a9]) and a value of type [weblogic.kernel.ResettableThreadLocal.ThreadStorage] (value [weblogic.kernel.ResettableThreadLocal$ThreadStorage@1f9c0d4c]) 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

We’re using many Agile sessions in parallel to get data of different products faster. The question is whether we could fix this issue in our code or we have to wait for an Agile API update.

Ben Agile User Answered on August 30, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.