-->
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.  [ 3 posts ] 
Author Message
 Post subject: Memory leak in AbstractBatcher with Generated Properties
PostPosted: Mon Oct 30, 2006 6:31 pm 
Beginner
Beginner

Joined: Tue Sep 02, 2003 9:28 pm
Posts: 25
Using Hibernate 3.2 GA with Entity Manager and Annotations, I have a batch job that inserts several thousands of objects for a class with a @Generated property. The job results in a memory leak in the AbstractBatcher class.

The problem appears to be in the method processGeneratedProperties in AbstractEntityPersister. This method closes the result set for the generated property query and calls session.getBatcher().closeStatement() to close the statement instead of session.getBatcher().closeQueryStatement to close both the statement and the result set. The result is that even though the result set is closed, it is not removed AbstractBatcher's resultSetsToClose HashSet.

Even though the batch job commits and clears the session every 200 rows, over time the leaked result sets in resultSetsToClose results in an OutOfMemory problem.

I've changed the code in AbstractEntityPersister.processGeneratedProperties to call session.getBatcher().closeQueryStatement and the same job then runs to completion without the memory leakage.

I noticed that this method in AbstractEntityPersister has had a recent change to fix a similar problem for issue HHH-1750, so I wanted to verify that this fix is the right approach.

Any insight is appreciated.

-Jay


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 7:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Create a JIRA entry for this. Then someone will take a look at it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 11:23 pm 
Beginner
Beginner

Joined: Tue Sep 02, 2003 9:28 pm
Posts: 25
JIRA issue HHH-2200 opened.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.