XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.0-rc1
    • 2.0-rc2
    • Core

    Description

      Dynamically loading a JAR that uses log4j2 results in a memory leak when the JAR is unloaded. This can be observed by deploying a web application to tomcat7 and exercising the stop, undeploy, or redeploy actions. The memory leak is believed to be caused by log4j for the following reasons:
      1)Heap Dump reveals the classloader instance responsible for the WAR plugin (of type org.apache.catalina.loader.WebappClassLoader) has 2 non weak/soft reference which are of type (org.apache.logging.log4j.core.LoggerContext$ShutdownThread) and (org.apache.logging.log4j.core.jmx.LoggerContextAdmin) after the WAR has been stopped or undeployed.
      2)Using SLF4J (slf4j-api, jcl-over-slf4j) to logback-classic logging output is equivalent but all memory is gc as expected (the org.apache.catalina.loader.WebappClassLoader which loaded the WAR is no longer referenced by any hard references)
      3)Using the SLF4J NOP logger implementation all memory is gc as expected (the org.apache.catalina.loader.WebappClassLoader which loaded the WAR is no longer referenced by any hard references)

      This may not be unique to 2.0rc-1 and I have seen similar behavior in previous 2.0 beta releases.

      This is reproducible with a very simple spring hello world application. Code and/or heap dumps can be provided upon request.

      Attachments

        Issue Links

          Activity

            People

              mattsicker Matt Sicker
              smitchel Scott
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: