Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1500

ThreadLocal leak in FlowControl

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.12, 3.2
    • 2.12.3
    • None
    • Hide

      Just create a JChannel in a web app, deploy on tomcat, then stop the app or shutdown tomcat and look at the log.

      Show
      Just create a JChannel in a web app, deploy on tomcat, then stop the app or shutdown tomcat and look at the log.

      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@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.

              rhn-engineering-bban Bela Ban
              elliotlovy Elliot Lovy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: