-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate/Spring remoting: PermGen space error
PostPosted: Wed Nov 08, 2006 4:26 pm 
Newbie

Joined: Wed Nov 08, 2006 4:16 pm
Posts: 4
Hi,

I'm having a problem with Spring/Hibernate and Java PermGen space.

I use Tomcat to deploy several web applications that use Hibernate persistence, and in order to manage certain properties of their model objects, I use Spring http remoting to a manager tool, which is a Tomcat servlet context itself.

In order to prevent LazyInitializationExceptions, I use the Hibernate's initialize()-Method on the object graphs I need.
Then, I pass the objects via Spring remoting to the manager tool, where I change certain properties and return them by passing them as arguments to update methods in the remoting target interface, which ultimately persists the changes by using Hibernate's update() method.

Here's my problem: Even though I don't keep references to the objects in my code for long, the Java PermGen space gets filled with every use case, and it never grows back.
Even when I just retrieve objects without updating them, even if they are identical to the last call, PermGen gets filled slowly but steadily.
Ultimately, both the manager tool and the business application crash because of an OutofMemoryException: PermGen space.

Is this a memory leak, or am I doing something fundamentally wrong?
Of course, I already set the PermGen to more than 100MB, but this just buys some time until the crash happens anyway.

I already updated to the latest available Hibernate version to make sure it's not an old Hibernate bug that has already been fixed.

Any ideas? Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Hibernate/Spring remoting: PermGen space error
PostPosted: Thu Nov 09, 2006 5:54 am 
Newbie

Joined: Thu Jun 09, 2005 11:28 am
Posts: 6
Location: Karlsruhe, Germany
Steven78 wrote:
Hi,

I'm having a problem with Spring/Hibernate and Java PermGen space.
I use Tomcat to deploy several web applications that use Hibernate persistence,
Here's my problem: Even though I don't keep references to the objects in my code for long, the Java PermGen space gets filled with every use case, and it never grows back.
Any ideas? Thanks in advance.


The PermGen Space is used for classes, not objects IIRC.
Do you get the error without HOT deploying wars?
To test this you can restart the tomcat after deploying a new war.

_________________
Don't forget to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 9:37 am 
Newbie

Joined: Wed Nov 08, 2006 4:16 pm
Posts: 4
I already did a search for this problem, and I'm aware that there are PermGen space problems with redeploying webapplications sometimes.

But that's not what causes my problems; I can stop, kill and restart Tomcat as often as I want after deployment, and PermGen space get filled during runtime. I can monitor how it gets filled with every remote call, so it has to be a problem with Hibernate initializaion, Spring remoting or something like that.

And I neither keep references to the object in my managertool for long, nor in the business application. Could it be that Hibernate or Spring use more PermGen space with every object I initialize and send via HttpRemoting?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 16, 2006 4:17 pm 
Newbie

Joined: Wed Nov 08, 2006 4:16 pm
Posts: 4
Alright, I found the solution.

The culprit was javassist (the bytecode provider for Hibernate). It turned out that, with each remote call, it created a proxy class and iterated the names even if identical objects were passed. So the PermGen was steadily filled to the limit.

The solution was to use cglib instead of javassist by simply changing a single line in the hibernate.properties file, from "hibernate.bytecode.provider javassist" to "hibernate.bytecode.provider cglib".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

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.