You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Torgeir Veimo <to...@pobox.com> on 2007/06/01 15:09:04 UTC

permgen w hibernate and webapp reload

I seen the problem with permgen errors when one is redeploying a  
webapp that uses hibernate described in a number of places, but I  
haven't seen any solution for it. The Tomcat FAQ even suggest that  
this is a problem with WebAppClassLoaders, http://tomcat.apache.org/ 
faq/memory.html#why .

This is an extremely annoying bug,  so I'm wondering, is this  
impossible to fix? Why does tomcat exhibit this problem when Jetty  
does not?



-- 
Torgeir Veimo
torgeir@pobox.com




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: permgen w hibernate and webapp reload

Posted by Martin Gainty <mg...@hotmail.com>.
On a side note:
If you're experiencing memory errors on Hibernate initialisation (the logs 
would verify)
Then I would Suggest setting Hibernate's lazy-init="true"

CAVEAT: If using in combination with Spring I would look at Session 
Management via OpenSessionInViewFilter

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Caldarale, Charles R" <Ch...@unisys.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Friday, June 01, 2007 9:44 AM
Subject: RE: permgen w hibernate and webapp reload


> From: Rene Guenther [mailto:innflow-guenther@innflow.com]
> Subject: Re: permgen w hibernate and webapp reload
>
> But those blog entries are the most entertaining ones:
> http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-p
> ermgen-outofmemoryerror
> http://my.opera.com/karmazilla/blog/2007/03/15/permgen-strikes-back

They may be entertaining, but that's largely because the author's
premise is a fantasy: his statement that the default GC mechanism in the
HotSpot JVM never collects PermGen is simply false.  There is one
optional (somewhat experimental) GC mechanism that doesn't yet process
PermGen, but you probably shouldn't be playing with GC algorithm
selection unless you're really intimate with the code.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: permgen w hibernate and webapp reload

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Rene Guenther [mailto:innflow-guenther@innflow.com] 
> Subject: Re: permgen w hibernate and webapp reload
> 
> But those blog entries are the most entertaining ones:
> http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-p
> ermgen-outofmemoryerror
> http://my.opera.com/karmazilla/blog/2007/03/15/permgen-strikes-back

They may be entertaining, but that's largely because the author's
premise is a fantasy: his statement that the default GC mechanism in the
HotSpot JVM never collects PermGen is simply false.  There is one
optional (somewhat experimental) GC mechanism that doesn't yet process
PermGen, but you probably shouldn't be playing with GC algorithm
selection unless you're really intimate with the code.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: permgen w hibernate and webapp reload

Posted by Rene Guenther <in...@innflow.com>.
Some encounter this problem also with jetty. Related to 
PermGen errors are often tools like hibernate, spring, 
cglib, tomcat and sun's java implementation (instead of 
BEAs JRockit).

I recently found the following Links:
http://wiki.caucho.com/OutOfMemoryError
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2481
http://forum.hibernate.org/viewtopic.php?t=947902&postdays=0&postorder=asc&highlight=leak+permgen&start=45
http://forum.springframework.org/showthread.php?t=21383
www.jroller.com/page/agileanswers/20060623

But those blog entries are the most entertaining ones:
http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-permgen-outofmemoryerror
http://my.opera.com/karmazilla/blog/2007/03/15/permgen-strikes-back


The following tomcat settings help (at least you increase 
the number of possible redeploys):
PermSize: 256m
MaxPermSize: 512m

René

On Fri, 1 Jun 2007 14:09:04 +0100
  Torgeir Veimo <to...@pobox.com> wrote:
> I seen the problem with permgen errors when one is 
>redeploying a  webapp that uses hibernate described in a 
>number of places, but I  haven't seen any solution for 
>it. The Tomcat FAQ even suggest that  this is a problem 
>with WebAppClassLoaders, http://tomcat.apache.org/ 
>faq/memory.html#why .
> 
> This is an extremely annoying bug,  so I'm wondering, is 
>this  impossible to fix? Why does tomcat exhibit this 
>problem when Jetty  does not?
> 
> 
> 
> -- 
> Torgeir Veimo
> torgeir@pobox.com
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: 
>users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: 
>users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: permgen w hibernate and webapp reload

Posted by David Delbecq <de...@oma.be>.
Hi,
The permgen problem with hibernate was due to a bug in CGLIB, used by
hibernate, which prevented classloaders from being garbage collected and
as such, the permgen memory used allocated during classloading could not
be freed at unload of webapp. This is supposed to be fixed since quite a
good amount of time. Unless you use a very old hibernate version, this
shouldn't be a problem. There are quite regulary bug reports about
memory leaks in hibernate on hibernate tracker, but most are irrelevant,
or fixed in more recent version.

When the webappclassloader does not get garbage collected, it's the
fault of the classes loaded by this classloader. One very common case i
saw is the use of ThreadLocal. ThreadLocal, behind the scene, attaches
the local value to the Thread Object. The locale value references it's
class, which reference it's classloader. The Classloader, even when not
referenced anymore by tomcat, does still get indirectly references by
the HttpThreadPool, preventing garbage collection. Another common way is
to link your object, referencing indirectly your webappclassloader, to
the JNDI and not removing it during unload.

En l'instant précis du 01/06/07 15:09, Torgeir Veimo s'exprimait en ces
termes:
> I seen the problem with permgen errors when one is redeploying a
> webapp that uses hibernate described in a number of places, but I
> haven't seen any solution for it. The Tomcat FAQ even suggest that
> this is a problem with WebAppClassLoaders,
> http://tomcat.apache.org/faq/memory.html#why .
>
> This is an extremely annoying bug,  so I'm wondering, is this
> impossible to fix? Why does tomcat exhibit this problem when Jetty
> does not?
>
>
>
> --Torgeir Veimo
> torgeir@pobox.com
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org