Re: CleanerThread never terminates, causes leaks in webapp

2010-02-18 Thread Joel Carranza

This is a real problem in cases where you want to perform a hot redeploy of
a webapp within Tomcat or other application servers. Single JVM, multiple
classloaders. A classloader (and all its classes) can only get GC'ed if
everything is cleaned up (including running threads). If you don't, after a
couple of deploys you get  a PermGen: Out of Memory error.

GeoTools basically has the identical problem
[http://jira.codehaus.org/browse/GEOT-2742]. I will investigate how to apply
a similar approach and submit a patch.

cheers,

Joel Carranza
j...@gatekeeper.com
Gatekeeper Systems


thomas.deweese wrote:
 
 Hi Joel,
 
 Joel Carranza j...@gatekeeper.com wrote on 02/17/2010 05:57:50 PM:
 
 We are using Batik in a webapp context and the thread
 org.apache.batik.util.CleanerThread never terminates.
 
 Correct, it is a daemon thread.  My understanding is
 that this signals the JVM that it can terminate it if 
 there is nothing else of interest in it's context.
 
 This is a serious problem as it prevents the webapp's classloader 
 from being garbage collected. 
 
Why is that a particularly serious problem?  It seems to
 me that generally speaking the classloader isn't GCed unless
 the JVM goes away anyway.
 
 Am I doing something wrong?  Is there a way to clean up and
 stop this thread when my webapp exits?
 
Batik doesn't provide one currently.  It's a little
 tricky since you shouldn't kill that thread until all objects that
 have been registered with the associated ReferenceQueue have been
 dequeued.
 
You might be able to do something with TheadGroups and 'stop'.
 You could also register a PhantomWeakReference and have it's
 'cleared()' method throw a ThreadDeath exception.
 
You also have access to the source and contributions are always
 welcome ;)
 
 

-- 
View this message in context: 
http://old.nabble.com/CleanerThread-never-terminates%2C-causes-leaks-in-webapp-tp27631790p27642863.html
Sent from the Batik - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



CleanerThread never terminates, causes leaks in webapp

2010-02-17 Thread Joel Carranza

We are using Batik in a webapp context and the thread
org.apache.batik.util.CleanerThread never terminates. This is a serious
problem as it prevents the webapp's classloader from being garbage
collected. Am I doing something wrong?  Is there a way to clean up and
stop this thread when my webapp exits?

Many thanks

Joel Carranza
j...@gatekeeper.com
Gatekeeper System
-- 
View this message in context: 
http://old.nabble.com/CleanerThread-never-terminates%2C-causes-leaks-in-webapp-tp27631790p27631790.html
Sent from the Batik - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org