You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Steffen Offermann (JIRA)" <ji...@apache.org> on 2016/09/06 08:11:21 UTC

[jira] [Comment Edited] (LOG4J2-1259) Log4j threads are leaking on tomcat shutdown

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

Steffen Offermann edited comment on LOG4J2-1259 at 9/6/16 8:10 AM:
-------------------------------------------------------------------

I was able to do a local build, and the result was:

- Before undeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-4-AsyncLoggerConfig-2	TIMED_WAITING	102		893		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5118f78a			37	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		1		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

- After undeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

- After redeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-4-AsyncLoggerConfig-2	TIMED_WAITING	96		676		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@7d134f0b			69	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		1		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5536ad8b			68	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}
- After undeploying it again:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5536ad8b			68	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

I.e. one thread remains active with every deployment/undeployment. I had managed to get that far with v2.6.2, too, in the meantime.



was (Author: steffeno):
I was able to do a local build, and the result was:

- Before undeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-4-AsyncLoggerConfig-2	TIMED_WAITING	102		893		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5118f78a			37	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		1		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

- After undeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

- After redeploying the web application:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-4-AsyncLoggerConfig-2	TIMED_WAITING	96		676		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@7d134f0b			69	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		1		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5536ad8b			68	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}
- After undeploying it again:
{noformat}
Thread Name	Thread State	Blocked Count	Blocked Time	Waited Count	Waited Time	Total CPU Usage(%)	Deadlocked	Lock Name	Lock Owner ID	Lock Owner Name	Thread Id	Native	Suspended	Allocated Bytes(bytes)
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5536ad8b			68	0	0	-256,236
Log4j2-TF-3-Scheduled-1	TIMED_WAITING	0		2		-45,623,600	Not Enabled	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@31d99db5			36	0	0	-256,236
{noformat}

I.e. one remains active with every deployment/undeployment. I had managed to get that far with v2.6.2, too, in the meantime.


> 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org