|
From: Alef A. <al...@jt...> - 2004-11-21 02:02:20
|
Didn't we come to conclusion some time ago that this is mainly a dom4j =
issue, with those full object constants?
=20
Alef
=20
p.s. mail from a couple of months ago:
=20
Op de een of andere manier worden full object constanten (private static =
final BlaType TRUE =3D new BLaType("true")) worden op de een of andere =
manier niet ge-GC'ed als je de classloader discard. Dit geeft problemen =
bij re-deployment in Tomcat en eigenlijk bij elke willekeurige andere =
servlet container (re-deployment is het discarding van een classloader =
die de webapp heeft ingeladen). Uiteraard is re-deployment tijdens =
productie niet echt ok, dus daar geeft het geen issues.
Anyway, er is gekeken naar Spring en er is het een en ander veranderd =
wat resource leaks in Spring voorkomt (zo goed als mogelijk), maar full =
object constanten zijn nou eenmaal een common programming style =
(hibernate gebruikt ze ook) dus het out-of-memory-probleem zal niet =
helemaal weg zijn zodra we naar Spring 1.0.2 (morgen uit) upgraden.
Hieronder concluderend verhaaltje van J=FCrgen.
Later,
Alef
I've just spent about 10 hours profiling Spring, using the Image =
Database and Petclinic samples. (BTW, I've used an evaluation version of =
JProfiler from ej-technologies - nice product!)
Although I still don't completely understand the garbage collection =
behavior, I've figured out the following issues. Each of them simply =
prevents the respective classes from getting garbage collected on =
destruction of the class loader (e.g. on Tomcat web app shutdown).
- A classic singleton with a class variable holding the object. I've =
reworked GlobalAdvisorAdapterRegistry and SQLErrorCodesFactory to hold =
the respective singleton as a WeakReference.
- A static cache. I've reworked CachedIntrospectionResults to use a =
WeakHashMap with WeakReferences as values.
- A ThreadLocal with a default other than null. I've reworked =
TransactionSynchronizationManager to use null as default for the =
resource map, setting a HashMap there on demand, removing the entire =
HashMap when unbinding the last resource.
- Constants that define a full object. We have a number of those, for =
example ClassFilters.TRUE and AdvisedSupport.EMPTY_TARGET_SOURCE. I've =
tried for quite a while, but I haven't been able to figure out a way to =
define such constants such that they will be garbage collected.
The latter programming style is not uncommon, so I really don't =
understand why it causes trouble with garbage collection. Hibernate uses =
a similar style for its FlushMode, for example.
In general, other frameworks like CGLIB, Hibernate, Velocity have huge =
resource leaks on web app shutdown, while just the constants issue =
remains with Spring now. As long as those huge third-party leaks are not =
addressed, I'm not worried at all by the single remaining Spring issue.
As I initially said, we shouldn't exaggerate the problem, as it =
basically just affects hot reloading of web apps - mainly a development =
feature anyway. We need to make that clear to users too, to avoid =
comments a la "Spring is not usable for real apps because it leaks on =
hot redeployment".=20
Juergen
=3D=3D
JTeam B.V.
Donker Curtiusstraat 7-412
1051 JL Amsterdam
T: +31 20 486 20 36
M: +31 6 24 11 1996
F: +31 84 837 00 00
E: al...@jt... <mailto:al...@jt...>=20
W: http://www.jteam.nl <http://www.jteam.nl> =20
________________________________
From: spr...@li... on behalf of =
Paul Buying
Sent: Sun 11/21/2004 2:45 AM
To: spr...@li...
Subject: Re: [Springframework-developer] Further Investigations into OOM =
Exceptions on Redeploy
Hi Seth,=20
I'm experiencing exactly the same problem in a Hibernate/Spring =
situation in our project. I'm able to redeploy somewhere around 25 =
times, then we need to start all over. The problem occurs both with =
deployment on Tomcat and JBoss.=20
Next to Hibernate we also indeed use cglib and dom4j.=20
Let me know if I can help by describing our situation here, or something =
else.=20
Rgds,=20
Paul.=20
Paul Buying=20
On 20 nov 2004, at 1:06, Seth Ladd wrote:=20
I wanted to send out this quick FYI. We have a new Spring/Hibernate=20
webapp starting up. I used this opportunity to look into OOM=20
Exceptions on redeploy (again).=20
Without Hibernate SessionFactory in my applicationContext, I seem to=20
be able to redeploy all day long. Once I add in the SessionFactory, I=20
can redeploy only 10-15 times before OutOfMemoryException.=20
The problem definitely seems to be from Hibernate, or cglib, or dom4j.=20
I'm going to try Guillaume Poirier's listener that cleans up Dom4J.=20
But, the good news is that it appears that Spring is good at not=20
leaving ClassLoaders around. I'll post anything if I found out more.=20
Thanks,=20
Seth=20
-------------------------------------------------------=20
This SF.Net email is sponsored by: InterSystems CACHE=20
FREE OODBMS DOWNLOAD - A multidimensional database that combines=20
robust object and relational technologies, making it a perfect match=20
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8=20
_______________________________________________=20
Springframework-developer mailing list=20
Spr...@li...=20
https://lists.sourceforge.net/lists/listinfo/springframework-developer=20
|