You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Joel Carranza <je...@gatekeeper.com> on 2010/02/17 23:57:50 UTC
CleanerThread never terminates, causes leaks in webapp
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
jec@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-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: CleanerThread never terminates, causes leaks in webapp
Posted by Helder Magalhães <he...@gmail.com>.
Hi Joel,
> 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?
Well, it's hard to guess is something is being done wrong having
provided such little information... ;-)
I'm assuming you are embedding an JSVGCanvas such as demonstrated in
the demo [1] page...? (Source code quickly available there.)
If you can steadily reproduce this, I'd ask you to provide a code
snippet of your application and/or the SVG file(s) which are making
this happen. :-)
Finally, if you are using this within a webapp (I'm assuming a
client-side application, but this somehow applies to server-side as
well), I'm not sure if you'd even want to terminate the environment
many times: that can become a heavy burden. I'd suggest looking into
the possibility of (for example) hiding the canvas whenever not needed
and display it again only with the needed tweaks/newly created
document (somehow a.k.a. object pooling).
> Many thanks
Hope this helps,
Helder
[1] http://xmlgraphics.apache.org/batik/demo.html
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: CleanerThread never terminates, causes leaks in webapp
Posted by Martin Jacobson <ja...@gmail.com>.
I am running a webapp (under both Tomcat 6 & 7) that exhibits the same
behaviour:
14-Apr-2011 10:32:54 org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/mapmosaic] appears to have started a
thread named [Batik CleanerThread] but has failed to stop it. This is
very likely to create a memory leak.
Under normal development conditions, the app is re-deployed many times
per day, and causes an OutOfMemoryError eventually. Even if in
production, the memory leak is so slow as to be negligeable, it would
be far better to provide a hook so I can terminate it when the webapp
closes.
Martin
On 12 April 2011 21:30, tiwaris <ti...@gmail.com> wrote:
> I also have encountered this issue. This happens rarely. When I quit my java
> app, it sill has not released the shell (the process is still running). I
> then used jvisualvm to monitor all the running threads in my application and
> noticed that Batik CleanerThread was still running.
>
> I incorporated the patch. Will have to see if the issue reappears.
>
>
> --
> View this message in context: http://batik.2283329.n4.nabble.com/CleanerThread-never-terminates-causes-leaks-in-webapp-tp2978944p3445621.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
>
>
--
>From my MacBook Pro
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: CleanerThread never terminates, causes leaks in webapp
Posted by tiwaris <ti...@gmail.com>.
I also have encountered this issue. This happens rarely. When I quit my java
app, it sill has not released the shell (the process is still running). I
then used jvisualvm to monitor all the running threads in my application and
noticed that Batik CleanerThread was still running.
I incorporated the patch. Will have to see if the issue reappears.
--
View this message in context: http://batik.2283329.n4.nabble.com/CleanerThread-never-terminates-causes-leaks-in-webapp-tp2978944p3445621.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
Re: CleanerThread never terminates, causes leaks in webapp
Posted by Helder Magalhães <he...@gmail.com>.
Hi everyone,
> 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.
I've just noticed bug 48771 [1] was created. (In general, it's always
good to have a link between mailing list threads and bug reports,
whenever they are tightly related such as in this case.)
Thanks,
Helder
[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=48771
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: CleanerThread never terminates, causes leaks in webapp
Posted by Joel Carranza <je...@gatekeeper.com>.
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
jec@gatekeeper.com
Gatekeeper Systems
thomas.deweese wrote:
>
> Hi Joel,
>
> Joel Carranza <je...@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
Re: CleanerThread never terminates, causes leaks in webapp
Posted by th...@kodak.com.
Hi Joel,
Joel Carranza <je...@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 ;)