Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358874

Summary: DeferredLoggingForwarder is not stopped when server webapp/war is undeployed
Product: [RT] Riena Reporter: Jürgen Becker <juergen.becker>
Component: CoreAssignee: Stefan Liebig <Stefan.Liebig>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.0.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Jürgen Becker CLA 2011-09-26 07:37:22 EDT
The DeferringLoggerFactory starts a new DeferredLoggingForwarder(which extends Thread). On the client side this is no problem, because the thread is stopped when the client application is stopped,
On the server side in a webapp container, like Tomcat, the thread is not stopped, after the application (war) is undeployed.
To verify this, undeploy the webapp and create a thread dump via "jstack <pid>" and search for DeferredLoggingForwarder. Something like this will show up - even after undeploying the webapp:
"DeferredLoggingForwarder" daemon prio=10 tid=0x00007f85381d4000 nid=0x1772 waiting on condition [0x00007f853fdc3000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000000ffb60078> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
	at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
	at org.eclipse.riena.internal.core.logging.DeferredLoggingForwarder.run(DeferredLoggingForwarder.java:47)

The running thread can prevent the container from freeing resources, resulting in memory leaks.
Comment 1 Stefan Liebig CLA 2011-09-27 04:54:57 EDT
The "DeferredLoggingForwarder" thread is now a Job and will be canceled when the riena.core bundle shuts down.