logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Tepikin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-323) ThreadLocal-leak on tomcat shutdown when using async logging
Date Fri, 11 Jul 2014 10:48:05 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14058638#comment-14058638
] 

Ilya Tepikin commented on LOG4J2-323:
-------------------------------------

Remko, I've just downloaded log4j2 binary and tried to reproduce the issue.
I have:
1. log4j*.jar in WEB-INF/lib
2. AsyncRoot in my log4j2.xml:
{code}
    <Loggers>
        <AsyncRoot level="debug">
            <AppenderRef ref="RollingRandomAccessFile" level="debug"/>
        </AsyncRoot>
    </Loggers>
{code}
3. removed Log4jContextSelector context-param from web.xml.

Now after redeploying my artifact I got:
{code}
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/Server] appears to have started a thread named [AsyncLoggerConfig-1]
but has failed to stop it. This is very likely to create a memory leak.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/Server] appears to have started a thread named [MySQL Statement
Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@238a55c7]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@4f058e0b]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@49971b88]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@5f90a376]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@10dbc8fe]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@4d68a457]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@10fd7375]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@6fa70f09]) 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.
Jul 11, 2014 1:23:10 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/Server] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@1bf7b4f9]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@40cc5123]) 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.
Jul 11, 2014 1:23:13 PM org.apache.catalina.startup.HostConfig undeploy
INFO: Undeploying context [/Server]

{code}

> ThreadLocal-leak on tomcat shutdown when using async logging
> ------------------------------------------------------------
>
>                 Key: LOG4J2-323
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-323
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta9
>         Environment: Mac OS X 10.8.4, Tomcat 7.0.42, java version 1.6.0_51
>            Reporter: Michael Kloster
>            Assignee: Remko Popma
>            Priority: Minor
>              Labels: Async
>             Fix For: 2.0-rc1
>
>
> When shutting down Tomcat 7.0.42, catalina.out displays the following warning indicating
a memory leak:
> {code}
> Jul 28, 2013 9:55:59 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["http-bio-8080"]
> Jul 28, 2013 9:55:59 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["ajp-bio-8009"]
> Jul 28, 2013 9:55:59 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 841 ms
> Jul 28, 2013 9:56:09 AM org.apache.catalina.core.StandardServer await
> INFO: A valid shutdown command was received via the shutdown port. Stopping the Server
instance.
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["http-bio-8080"]
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
> Jul 28, 2013 9:56:09 AM org.apache.catalina.core.StandardService stopInternal
> INFO: Stopping service Catalina
> Jul 28, 2013 9:56:09 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
> SEVERE: The web application [/asynclog] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@648bfdea]) and a value of type [org.apache.logging.log4j.core.async.AsyncLogger.Info]
(value [org.apache.logging.log4j.core.async.AsyncLogger$Info@4e26d560]) 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.
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-bio-8080"]
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["http-bio-8080"]
> Jul 28, 2013 9:56:09 AM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
> {code}
> {code:xml|title=log4j2.xml|borderStyle=solid}
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="WARN">
>   <appenders>
>     <FastRollingFile name="MyFileLog" filename="logs/my.log"
>       filePattern="logs/my-%d{COMPACT}.log">
>         <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" />
> 	<Policies>
> 	  <SizeBasedTriggeringPolicy size="5MB" />
> 	</Policies>
>     </FastRollingFile>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" />
>     </Console>
>   </appenders>
>   <loggers>
>     <logger name="mylogger" level="INFO" additivity="false">
>       <appender-ref ref="MyFileLog" />
>     </logger>
>     <root level="TRACE">
>       <appender-ref ref="Console" />
>     </root>
>   </loggers>
> </configuration>
> {code}
> {code:title=log4j2.xml|borderStyle=solid}
> #!/bin/bash
> CATALINA_OPTS=-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message