[jboss-jira] [JBoss JIRA] (JGRP-1655) ThreadLocal leaks discovered after enabling Tomcat 7 ThreadLocal detection listener
Manuel Dominguez Sarmiento (JIRA)
jira-events at lists.jboss.org
Sun Jul 14 20:53:26 EDT 2013
[ https://issues.jboss.org/browse/JGRP-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789540#comment-12789540 ]
Manuel Dominguez Sarmiento commented on JGRP-1655:
--------------------------------------------------
It seems this leak could be fixed by modifying this block:
if(ignore_synchronous_response && ignore_thread.get()) { // JGRP-465
if(log.isTraceEnabled())
log.trace("bypassing flow control because of synchronous response " + Thread.currentThread());
break;
}
to the following:
if(ignore_synchronous_response) {
if (ignore_thread.get()) {
if(log.isTraceEnabled())
log.trace("bypassing flow control because of synchronous response " + Thread.currentThread());
break;
} else {
ignore_thread.remove();
}
}
The reasoning is that get() will only return false if the value had been previously not been initialized in up(Event) or up(MessageBatch). So it makes sense to remove() the false value, so we clean up the ThreadLocal we have just initialized by invoking get()
It would be easier if we had ThreadLocal.isInitialized() or something similar, however the JDK does not expose this, without resorting to reflection.
> ThreadLocal leaks discovered after enabling Tomcat 7 ThreadLocal detection listener
> -----------------------------------------------------------------------------------
>
> Key: JGRP-1655
> URL: https://issues.jboss.org/browse/JGRP-1655
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 3.3.2
> Reporter: Manuel Dominguez Sarmiento
> Assignee: Bela Ban
> Fix For: 3.4
>
>
> After enabling Tomcat 7's org.apache.catalina.core.ThreadLocalLeakPreventionListener, we found this while undeploying our webapp:
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal at 6ae3209a]) and a value of type [org.jgroups.protocols.TP.ProtocolAdapter] (value [locks (21)]) 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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/cms] created a ThreadLocal with key of type [org.jgroups.protocols.FlowControl$1] (value [org.jgroups.protocols.FlowControl$1 at 536c4bc7]) and a value of type [java.lang.Boolean] (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.
> Jul 12, 2013 11:19:04 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list