-->
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.  [ 10 posts ] 
Author Message
 Post subject: serious memory issues when swithcing to 2.1.x vs 2.0.3
PostPosted: Tue Jan 27, 2004 5:30 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
hello, everybody

I ran into serious memory issues with Hibernate. All I do is simply try to instantiate a SessionFactory, nothing more. The schema is mildly complex (681 tables of 10 to 40 columns), using one-to-many and many-to-one wherever this is possible, lazy loading wherever this is possible.

Using Hibernate 2.0.3, the results are the following :
- time to instantiate a SessionFactory = between 30 and 35 seconds
- used memory as reported by runtime = apx. 25MB

Using Hibernate 2.1.1beta6 (doesn't compile yet with 2.1.1final and I really don't want to mess with it until I find the root of the problem):
- after apx 60 seconds configuration.buildSessionFactory() gives up with an OutOfMemory report, usually something in the lines of :

Code:
GRAVE: CGLIB Enhancement failed
net.sf.cglib.CodeGenerationException
   at net.sf.cglib.CodeGenerator.define(CodeGenerator.java:179)
   at net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:239)
   at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:221)
   at net.sf.cglib.Enhancer.enhance(Enhancer.java:149)
   at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:52)
   at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:747)
   at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:749)
   at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:41)
   at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:718)
   at fr.infologic.testhibby.HibernateInitializer.createSessionFactory(HibernateInitializer.java:98)
   at fr.infologic.testhibby.HibernateInitializer.getSessionFactory(HibernateInitializer.java:40)
   at fr.infologic.testhibby.TestHibby.performBenchmark(TestHibby.java:37)
   at fr.infologic.testhibby.TestHibby.main(TestHibby.java:22)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at net.sf.cglib.CodeGenerator.defineClass(CodeGenerator.java:205)
   at net.sf.cglib.CodeGenerator.define(CodeGenerator.java:175)
   ... 13 more
Caused by: java.lang.OutOfMemoryError
Exception in thread "main"


OutOfMemory happens even with absurd settings such as "-Xms1500M -Xmx1500M -Xss32M". I have tried tens of combinations of memory sizes and still unable to pass the sessionfactory instantiation phase...

My hibernate.properties:
Code:
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
hibernate.query.imports net.sf.hibernate.test, net.sf.hibernate.eg
hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
hibernate.connection.username TEST
hibernate.connection.password *********
hibernate.connection.url jdbc:sapdb://localhost/TST?cache=s&timeout=0
hibernate.connection.pool_size 10
hibernate.statement_cache.size 10
hibernate.dbcp.maxActive 100
hibernate.dbcp.whenExhaustedAction 1
hibernate.dbcp.maxWait 120000
hibernate.dbcp.maxIdle 10
hibernate.dbcp.testOnBorrow true
hibernate.dbcp.ps.maxActive 100
hibernate.dbcp.ps.whenExhaustedAction 1
hibernate.dbcp.ps.maxWait 120000
hibernate.dbcp.ps.maxIdle 100
hibernate.dbcp.validationQuery select 1 from dual
hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider
hibernate.show_sql false
hibernate.jdbc.batch_size 0
hibernate.jdbc.use_streams_for_binary true


Database is SAPDB 7.4.0.23.27, jdbc driver from sap.org, Implementation-Version: 7.4.4 Build 001-000-156-985

Please please tell me :
- my configuration is f@{#ed OR
- this is a known issue, solved in 2.1.1final OR
- I am dumb and doing something terribly wrong

Thank you,
Adrian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 5:37 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
To complete my post : between tests, I am replacing all jars pertaining to Hibernate (as a matter of fact I have two 'libs' directories and switching between two succesive test runs).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 5:52 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
OK, so it might be a cglib issue ?
http://opensource.atlassian.com/project ... key=HB-327
Opinions ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 5:59 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
aspinei wrote:
OK, so it might be a cglib issue ?
http://opensource.atlassian.com/project ... key=HB-327
Opinions ?


Use 2.1.1.
This version corrects some bugs that existed in the CGLIB in the 2.1.X beta's.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 6:06 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
What is the result when you turn off cglib optimisation?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 6:09 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
same symptoms with cglib-asm 1.1RC1 (released 12.12.2003)
will try to disable cglib optimisation
Dammit, I wish I could edit my posts !?!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 6:20 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
Code:
hibernate.cglib.use_reflection_optimizer=false


... right ? Umm, nothing changed :(

Wil suggest to my team-mates responsible with Hibernate layer, to adapt the code for integration with 2.1.1final, but it doesn't look very good from where I stand right now.
Will try some profiling later, as currently there are some other tasks on my priority list.

Thanks,

Adrian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 10:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Upgrade to 2.1.1 as advised.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2004 8:05 am 
Newbie

Joined: Tue Jan 27, 2004 5:12 am
Posts: 6
Thaks for the advice...
2.1.1 worked fine (so it's clearly a problem with beta6). FYI, the new SessionFactory needs 50-60s to initialize (almost 2x as 2.0) and 33MB of memory were reported by the runtime. Totally bearable for a server startup in production environment ...
Kudos for a great product,
Adrian


Top
 Profile  
 
 Post subject: -XX:MaxPermSize
PostPosted: Thu Jun 03, 2004 11:30 am 
Newbie

Joined: Wed Mar 31, 2004 11:40 am
Posts: 4
try to increase your MaxPermSize
I had the same problem and posted the solution here :

http://forum.hibernate.org/viewtopic.ph ... emoryerror

cheers


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