Issue 122517

Summary: AsynchronousFinalizer causes memory leaks
Product: App Dev Reporter: Mattias Jiderhamn <mj-lists>
Component: sdkAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: issues
Version: 3.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description Mattias Jiderhamn 2013-06-12 07:21:31 UTC
In a multi classloader environment, such as a web container, the com.sun.star.lib.util.AsynchronousFinalizer class of JURT/Java Uno RunTime has the potential of causing classloader leaks, and eventually crashes due to java.lang.OutOfMemoryError: PermGen space.

This is because AsynchronousFinalizer starts a Thread that will never finish, which causes problems at application redeploy. More about the problem at http://java.jiderhamn.se/2012/01/15/classloader-leaks-iii-die-thread-die/

At the very least, there should be a way of telling AsynchronousFinalizer to shut down the thread gracefully. I realize however this can be complicated, as the thread is supposed to process Jobs added to the queue by the finalize() method of other objects, which may be garbage collected after the web application/classloader is supposedly unloaded.

One alternative might be, that the signal to shutdown does not stop the thread right away, but rather when X seconds have passed AND there are no more items in queue. It should be possible to make things more complicated, for example by starting a new thread if jobs are added after that.