You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Iñaki Ibarrola Atxa (Jira)" <ji...@apache.org> on 2020/07/08 12:19:00 UTC

[jira] [Created] (LOG4J2-2887) Log4j possibly leaking on Tomcat shutdown when ScriptFilter is used

Iñaki Ibarrola Atxa created LOG4J2-2887:
-------------------------------------------

             Summary: Log4j possibly leaking on Tomcat shutdown when ScriptFilter is used
                 Key: LOG4J2-2887
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2887
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.13.3
            Reporter: Iñaki Ibarrola Atxa
         Attachments: scriptrunner-thread-shutdown.zip

If an appender uses a ScriptFilter Tomcat complains that a thread local has not been removed when the application is closed.

Can this create a memory leak? 

Could log4j-web remove the thread local to avoid the possible memory leak and this confusing message?

This behaviour can be reproduced in the attached project: [^scriptrunner-thread-shutdown.zip]

{{org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [scriptrunner-thread-shutdown] created a ThreadLocal with key of type [org.apache.logging.log4j.core.script.ScriptManager$ThreadLocalScriptRunner$1] (value [org.apache.logging.log4j.core.script.ScriptManager$ThreadLocalScriptRunner$1@3cbad4bf]) and a value of type [org.apache.logging.log4j.core.script.ScriptManager.MainScriptRunner] (value [org.apache.logging.log4j.core.script.ScriptManager$MainScriptRunner@3f588643]) 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.}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)