Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358877 - WeakRef$Remover is not stopped when server webapp/war is undeployed
Summary: WeakRef$Remover is not stopped when server webapp/war is undeployed
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: Core (show other bugs)
Version: 4.0.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Liebig CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-26 08:18 EDT by Jürgen Becker CLA
Modified: 2011-09-27 04:54 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Becker CLA 2011-09-26 08:18:44 EDT
The WeakRef starts a new Remover(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 WeakRef. Something like this will show up -
even after undeploying the webapp:

"WeakRef remover" daemon prio=10 tid=0x0000000041b82000 nid=0x212a in Object.wait() [0x00007f37be168000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000fecd5188> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
        - locked <0x00000000fecd5188> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
        at org.eclipse.riena.core.util.WeakRef$Remover.run(WeakRef.java:91)

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