-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 85 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Problem with redeploy
PostPosted: Sat Apr 24, 2004 7:03 pm 
Newbie

Joined: Thu Jan 08, 2004 6:28 am
Posts: 11
Hi All,

I am using hibernate 2.1.2 with cglib 2.01 and tomcat 5.

When I redeploy my war I see that my memory usage is growing.
I investigated it and I came to conclusion that the jvm is not destructing my war classes because it can not destruct the WebappClassLoader, and it can not destruct the WebappClassLoader because there are hard references to it from cglib.

Meaning there is some kind of loop, the WebappClassLoader have references to the cglib classes and the cglib classes have refrences to the WebappClassLoader.

There is an option to use hibernate without cglib?
Did any one has the same problem and/or have a solution to it?

Avi


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2004 7:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Discuss this on the cglib forums/mailinglists please. You can try hibernate.cglib.use_reflection_optimizer=false in your hibernate.properties and not using proxys.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 4:29 am 
Newbie

Joined: Thu Jan 08, 2004 6:28 am
Posts: 11
I will ask the question in th cglib forum, but the peoblem still exists!
Can I use hibernate without cglib?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 6:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
As I said, You can try hibernate.cglib.use_reflection_optimizer=false in your hibernate.properties and not using proxys. But i don't know if that solves the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 6:46 am 
Newbie

Joined: Thu Jan 08, 2004 6:28 am
Posts: 11
I tried that but it didn't solve the problem.
Any other suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 7:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 8:04 am 
Newbie

Joined: Thu Jan 08, 2004 6:28 am
Posts: 11
So it mean that anyone who use hibernate and need to redeploy his application for several times must expect OutOfMemoryError sometime.

I would expect from skilled people like hibernate guys not to use problematic frameworks because it's very unprofessional, even though hibernate is free.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 8:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please do not use Hibernate, this project is intended for people with a basic level of respect for others, and basic problem solving skills.

Christian please ban this guy.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 9:47 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Try to download cglib 2.0.1, I am sure this version will not cause memory leak after redeploy (tested), but cglib 2 causes it (tested too).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 25, 2004 12:26 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I see you use cglib 2.01, it must drop classloader (if it is not loaded by the same classloader itself).
Are you sure there is no "old" jar, Proxool depends on cglib too.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 19, 2004 10:33 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 10:21 pm
Posts: 40
Location: Honolulu, HI
Just an FYI... we use cglib-full-2.0.2.jar, and we still see CGLIB generated proxies never getting garbage collected. I am using JProfiler to watch memory usage.

Also, it seems dom4j has some caches it never cleans up, as we see the edu.oswego.* classes grow in usage, and they are traced back to dom4j's NamespaceCache.

So there are at least 2 reasons why Hibernate leaks memory on webapp redeploys, but both are not directly hibernate, but jars hibernate uses (cglib and dom4j).


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 20, 2004 2:56 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Try to isolate and reproduce it in test case, watching memory usage with doe's not help to fix bugs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 22, 2004 2:05 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 10:21 pm
Posts: 40
Location: Honolulu, HI
It's easy to reproduce... just create a simple Hibernate app and redeploy using your container's hot deploy mechanism. You will receive an OOM Exception after a limited (< 20) number of redeploys (depending on how much memory you have given to your container, of course).

The problem is the web application classloader is never garbage collected. We believe this is because dom4j uses threadlocals internally and never cleans them up. This essentially binds a class loaded by the (transient) web application classloader into a container's thread. Since the container's thread never dies, the classloader never goes away.

We're still performing tests to verify it's dom4j's problem. We're nearly certain.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 5:31 pm 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
have anyone found a solution???


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 6:22 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 10:21 pm
Posts: 40
Location: Honolulu, HI
Actually, I think there is a solution now.

- upgrade to latest DOM4J (1.6.1 ?)
- upgrade to latest CGLIB (I forget)
- do one of the following:

- put your database drivers into your app server classpath, and keep them out of your webapp

OR

- keep them in your webapp, but unload the drivers on webapp redeploy. You can do this pretty easily with a servlet context listener. Use this: http://www.patrickpeak.com/page/patrick ... is_leaking

Also,

it's a classloader issue. Don't share classloaders. Also, don't put anything into ThreadLocal you can't guarantee you can take out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 85 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.