[jboss-jira] [JBoss JIRA] (JGRP-1500) ThreadLocal leak in FlowControl

Elliot Lovy (JIRA) jira-events at lists.jboss.org
Tue Aug 14 09:02:14 EDT 2012


Elliot Lovy created JGRP-1500:
---------------------------------

             Summary: ThreadLocal leak in FlowControl
                 Key: JGRP-1500
                 URL: https://issues.jboss.org/browse/JGRP-1500
             Project: JGroups
          Issue Type: Bug
    Affects Versions: 2.12.3
         Environment: Tomcat
            Reporter: Elliot Lovy
            Assignee: Bela Ban


org.jgroups.protocols.FlowControl has a thread local leak.

Tomcat's memory management shows:
SEVERE: The web application [/app] created a ThreadLocal with key of type [null] (value [org.jgroups.protocols.FlowControl$1 at 79c1187f]) and a value of type [java.lang.Boolean] (value [false]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

The fix seems straightforward to me, just replace the two instances of:
ignore_thread.set(false);
with
ignore_thread.remove();

I have verified this does indeed prevent the leak.

Since false is the default value the thread local would get created with, then setting it to false is equivalent to removing it, with the added benefit of actually removing the ThreadLocal from the application server's thread.
So it only exists while it is set to true.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list