Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-578

JMX Memory Leak in Servlet Container

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.0-rc1
    • 2.5
    • Core

    Description

      If JMX is enabled in Log4j2 (it is by default) and a web application is unloaded then Log4j2 creates a memory leak. This can be observed by deploying a web application to tomcat7 and exercising the stop, undeploy, or redeploy actions. The "unloaded" terminology is meant to be generic across servlet containers in that any action which is designed to make the web application classes eligible for GC. 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 (for tomcat7 is of type

      org.apache.catalina.loader.WebappClassLoader

      ) has 1 non weak/soft reference which is of type

      org.apache.logging.log4j.core.jmx.LoggerContextAdmin

      after the WAR has been stopped or undeployed.

      2) Disabling JMX in Log4j2 (see http://logging.apache.org/log4j/2.x/manual/jmx.html) results in no memory leaks and all resources are GC as expected.

      Attachments

        1. smem.tar.gz
          5 kB
          Scott

        Issue Links

          Activity

            People

              rpopma Remko Popma
              smitchel Scott
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: