-->
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: Threads stuck inside QueryPlanCache
PostPosted: Wed Jul 26, 2006 1:47 pm 
Newbie

Joined: Wed Jul 26, 2006 12:45 pm
Posts: 3
Hi guys,
We have a stand alone Java application that uses Hibernate. Lately during some tests I have started seeing threads getting stuck doing calls to QueryPlanCache. Basically what happens is that one thread reaches the Commons Collections method ReferenceMap.purge(), and goes into what looks like an infinite loop. The CPU gets pegged at 100%. All the other threads in the app in turn are blocked waiting for the purge operation to finish, which never happens. A thread dump is attached at the end of the post.

I've not been able to consistently replicate this. My tests usually run for a couple of hours and sometime during the run the app gets stuck, but it doesn't seem to be caused by a specific event. The application uses a lot of memory, ~2 GB, so it might have something to do with garbage collection or the virtual machine. I doubt it's an actual problem with Hibernate or even a bug in Commons collections.

Has anybody seen something like this? Are there any workarounds or anything else I should look out for? Any ideas or thoughts are appreciated. Thanks!
/ Per


Hibernate version:
3.1

Commons collections 3.1
Sun JDK 1.5.0_07

Mapping documents:
<?xml version='1.0' ?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<!-- db connection -->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@(DESCRIPTION=...</property>
<property name="hibernate.connection.username">...</property>
<property name="hibernate.connection.password">...</property>
<!-- connection pooling -->
<property name="hibernate.c3p0.max_size">7</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.timeout">1800</property>
<!-- can idle 1800 secs before being deleted -->
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">600</property>
<!-- test idle connection very 600 secs -->
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.validate">false</property>
<!-- see idle_test_period -->
<!-- other db settings -->
<property name="hibernate.show_sql">false</property>
<property name="max_fetch_depth">4</property>
<property name="hibernate.jdbc.batch_size">10</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory</property>
<!-- cache configuration -->
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_minimal_puts">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
...
</session-factory>
</hibernate-configuration>

Thread dump:

"T-1" prio=1 tid=0x088eade8 nid=0x6d91 runnable [0x3d0fe000..0x3d0ff030]
at org.apache.commons.collections.ReferenceMap.purge(ReferenceMap.java:461)
at org.apache.commons.collections.ReferenceMap.purge(ReferenceMap.java:447)
at org.apache.commons.collections.ReferenceMap.get(ReferenceMap.java:517)
at org.hibernate.util.SimpleMRUCache.get(SimpleMRUCache.java:24)
- locked <0x471ef518> (a org.hibernate.util.SimpleMRUCache)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:65)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)

"T-2" prio=1 tid=0x085ce820 nid=0x6d92 waiting for monitor entry [0x3d07d000..0x3d07e0b0]
at org.hibernate.util.SimpleMRUCache.get(SimpleMRUCache.java:24)
- waiting to lock <0x471ef518> (a org.hibernate.util.SimpleMRUCache)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:65)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)

Name and version of the database you are using:

Oracle 10G


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 3:20 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
check the change logs, I can recall we fixed some stuffs in this area a long time ago

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 12:13 pm 
Newbie

Joined: Wed Jul 26, 2006 12:45 pm
Posts: 3
Upgrading to 3.1.3 seems to have fixed the problem. Guess this must have been bug HHH-1486.

Thanks again.


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.