-->
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.  [ 5 posts ] 
Author Message
 Post subject: hibernate Out of memory
PostPosted: Fri Jul 21, 2006 7:42 am 
Newbie

Joined: Fri Jul 21, 2006 7:32 am
Posts: 4
hi,
we have deployed 5 applications on tomcat 5.0 server.
One application communicates with other 4 for data retrieval. All 5 are using hibernate to connect to database. Databases used are different (Oracle 9i, mySQL, etc..) Data is only fetched from these databases and there are no data manipulations done.
We are facing issues of out of memory error after every 1-2 days or if large number of users are logging in.
Any pointers to optimize the hibernate related settings?
can sessionFactory.close() be used to release resources? and how to use it?
Hibernate version is 2.0.

I have checked the code as far as GC is concerned and its absolutely fine.

Please help ASAP. thanks in advance.

~vishal.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 21, 2006 9:28 am 
Newbie

Joined: Wed Oct 12, 2005 11:17 am
Posts: 7
You didn't provide enough details. Would it be possible for you to show which lines in your code prompt the outOfMemoryException?

I hope that you are closing your hibernate sessions. You MUST do this to release resources.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 21, 2006 10:57 am 
Newbie

Joined: Fri Jul 21, 2006 6:27 am
Posts: 10
if the problem occurs after a certain amount of time, meaning: not just because of an Exception that is thrown by the code everytime its run, i dont think its got something to do with settings/properties.

i suggest to look at some code examples and find out in which way they differ from your own code.

chris
p.s.: aphawkes is right, not enough details...how did you manage to not notice the posting guidelines? i saw them at least 3 times before posting. =)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 3:58 am 
Newbie

Joined: Fri Jul 21, 2006 7:32 am
Posts: 4
hi,
the details given are enough i think.
Because the hibernate related code (creating session factory, session etc.) is same as the standard code. the problem comes at different times so i can not give the log where the error is being thrown.
What i want to ask is can we use session.closeFactory(), what are the pros-cons for the same as far as GC is concerned.

~vishal.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 8:29 am 
Newbie

Joined: Wed Oct 12, 2005 11:17 am
Posts: 7
I'll not copy the documentation, as the rules of the forum say not to. You may want to read them. They're quite good.

Basically, calling close will close the JDBC connection, which may or may not be appropriate for what you want to do. Disconnect is similar, but its behavior changes depending upon how the JDBC connection was created. I don't think you'd want to do close() unless you were really sure that you were done with whatever transactions you were performing.

I ask where the application runs out of memory because this is usually caused by an inappropriate fetching strategy. For example, if it typically runs out of memory performing a list() on a criteria, then perhaps too many records are being pulled into memory. If it fails after attempting to perform thousands of updates without intermittent flushes or commits, then perhaps the cache is growing too large. I know you say you don't perform any updates, only queries, but it 's just an example.

Oh, and have you checked the tomcat settings for memory. Perhaps it is using the default maximum heap size, which could be too small.

I don't think it is unreasonable to show at least some examples of where it fails (or at least where you think it fails) so we can look at what's going on. All you've basically told us is that you have 5 apps on tomcat which connects to multiple database types and it runs out of memory intermittently at times of high load. Hmm, do you think you could help troubleshoot something remotely given this information? Maybe I'm just not that good.


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