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

JMX Memory Leak in Servlet Container

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-rc1
    • Fix Version/s: 2.5
    • Component/s: Core
    • Labels:
    • Environment:

      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

        Issue Links

          Activity

            People

            • Assignee:
              rpopma Remko Popma
              Reporter:
              smitchel Scott

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment