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

Gabriel Stanek commented on LOG4J2-1259:
----------------------------------------

Good catch on the log4j-web module.  It appears I did not read far enough down 
on the maven page to see the additional module was needed.  Unfortunately, even 
with the module included, I still see similar exceptions.  I included the 
module as a runtime dependency:
{code:xml}
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-web</artifactId>
    <version>2.6.3-SNAPSHOT</version>
    <scope>runtime</scope>
</dependency>
{code}

When looking at the lib folder of the generated war, I do see one extra log4j 
related jar: log4j-1.2.16
That jar is brought in from a dependency.  I don't anticipate that it would 
cause a conflict, but wanted to point it out in case you think it would.

Latest log output on app shutdown (Tomcat still running):
{code:xml}
Sep 21, 2016 11:32:34 AM org.apache.catalina.startup.HostConfig undeploy
INFO: Undeploying context [/webs-pub-subscription-usage-api]
Sep 21, 2016 11:32:34 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesJdbc
SEVERE: The web application [/webs-pub-subscription-usage-api] registered the 
JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web 
application was stopped. To prevent a memory leak, the JDBC Driver has been 
forcibly unregistered.
Sep 21, 2016 11:32:34 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/webs-pub-subscription-usage-api] appears to have 
started a thread named [Log4j2-TF-3-Scheduled-1] but has failed to stop it. 
This is very likely to create a memory leak.
Sep 21, 2016 11:32:34 AM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/webs-pub-subscription-usage-api] appears to have 
started a thread named [Log4j2-TF-4-AsyncLoggerConfig-2] but has failed to stop 
it. This is very likely to create a memory leak.
Sep 21, 2016 11:32:52 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  
Could not load 
org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationWorker.
  The eventual following stack trace is caused by an error thrown for debugging 
purposes as well as to attempt to terminate the thread which caused the illegal 
access, and has no functional impact.
java.lang.IllegalStateException
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1614)
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
        at 
org.apache.logging.log4j.core.config.ConfiguratonFileWatcher.fileModified(ConfiguratonFileWatcher.java:46)
        at 
org.apache.logging.log4j.core.util.WatchManager$WatchWorker.run(WatchManager.java:103)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
{code}

The "SEVERE" entries related to Log4j2 occur nearly immediately after the 
shutdown process initiates, so it seems the delay is not taking affect. 

> Log4j threads are leaking on Tomcat shutdown
> --------------------------------------------
>
>                 Key: LOG4J2-1259
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1259
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.5
>            Reporter: Misagh Moayyed
>
> Running log4j2 v2.5 with disruptor 3.3.x. AsyncLoggers configured. log4j-web 
> also included in the web application deployed in Tomcat 8. The context 
> listener is correctly starting up and shutting down, catalina.properties does 
> not include the log4j*.jar entry. Yet I see:
> {code}
> 20-Jan-2016 14:59:26.322 WARNING [localhost-startStop-2] 
> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The 
> web application [cas-server-webapp-4.3.0-SNAPSHOT] appears to have started a 
> thread named [Log4j2-Log4j2Scheduled-5] but has failed to stop it. This is 
> very likely to create a memory leak. Stack trace of thread:
>  sun.misc.Unsafe.park(Native Method)
>  java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
>  
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
>  
> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
>  
> java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
>  java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
>  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
>  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  java.lang.Thread.run(Thread.java:745)
> 20-Jan-2016 14:59:26.336 WARNING [localhost-startStop-2] 
> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The 
> web application [cas-server-webapp-4.3.0-SNAPSHOT] appears to have started a 
> thread named [Log4j2-AsyncLoggerConfig-6] but has failed to stop it. This is 
> very likely to create a memory leak. Stack trace of thread:
>  sun.misc.Unsafe.park(Native Method)
>  java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
>  
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
>  com.lmax.disruptor.BlockingWaitStrategy.waitFor(BlockingWaitStrategy.java:45)
>  
> com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56)
>  com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:124)
>  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  java.lang.Thread.run(Thread.java:745)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to