xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Carranza <...@gatekeeper.com>
Subject Re: CleanerThread never terminates, causes leaks in webapp
Date Thu, 18 Feb 2010 17:52:04 GMT

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.


Joel Carranza
Gatekeeper Systems

thomas.deweese wrote:
> Hi Joel,
> Joel Carranza <jec@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-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message