Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2017

ThreadLocal leaks in Tomcat8 (org.jboss.weld.context.AbstractManagedContext.ManagedState)

XMLWordPrintable

    • Hide

      Simple webapp with one xhtml page retrieving value from a CDI bean.

      Example:

      <!DOCTYPE html>
      <html xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:head>
      <title>Test</title>
      </h:head>
      <h:body>
      <div>
      <h2>Welcome #{testView.name}</h2>
      </div>
      </h:body>
      </html>

      Open page once and then trigger Tomcat reload to receive the ThreadLocal messages.

      Show
      Simple webapp with one xhtml page retrieving value from a CDI bean. Example: <!DOCTYPE html> <html xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title>Test</title> </h:head> <h:body> <div> <h2>Welcome #{testView.name}</h2> </div> </h:body> </html> Open page once and then trigger Tomcat reload to receive the ThreadLocal messages.

      I'm getting ThreadLocal leaks during Tomcat reload when using the latest WELD:

      Aug 21, 2015 2:42:10 PM org.apache.catalina.core.StandardContext reload
      INFORMATION: Reloading Context with name [/webapp] has started
      Aug 21, 2015 2:42:10 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
      SCHWERWIEGEND: The web application [webapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@e6a486]) and a value of type [org.jboss.weld.context.AbstractManagedContext.ManagedState] (value [org.jboss.weld.context.AbstractManagedContext$ManagedState@30506b]) 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.
      [...]

              mkouba@redhat.com Martin Kouba
              jansohn_jira Robin Jansohn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: