-->
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: ConcurrentModificationException results in infinite loop
PostPosted: Thu Nov 29, 2007 7:57 am 
Newbie

Joined: Thu Dec 29, 2005 12:47 pm
Posts: 4
Hibernate version: 3.2.5.ga

Full stack trace of any exception that occurs:
28/11 20:16:50 WARN AbstractBatcher [resin-tcp-connection-myserver:6001-15] Could not close a JDBC result set
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
at java.util.HashMap$KeyIterator.next(HashMap.java:877)
at org.hibernate.jdbc.AbstractBatcher.closeStatements(AbstractBatcher.java:314)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:382)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:324)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:298)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSession(SessionFactoryUtils.java:774)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.closeSession(OpenSessionInViewFilter.java:252)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:419)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
at com.caucho.util.ThreadPool.run(ThreadPool.java:425)
at java.lang.Thread.run(Thread.java:595)

[repeat this a thousand times or more]

Name and version of the database you are using: MySQL 5.0.42


In case there is a ConcurrentModificationException thrown when iterating over the resultSetsToClose HashSet in AbstractBatcher.closeStatements() the exception will be caught by the catch(Throwable) clause. However, the iteration may continue infinitely because of the corrupted HashSet. This pegs one CPU and produces a large log file.

The catch(Throwable) block was added in Hibernate 3.2.3 if I saw that correctly. Apparently the reason was to catch a NPE thrown by a sybase driver here, but catching Throwable produces this side-effect.

I can submit a bug report to JIRA about this, but I wanted to post it here first in case I miss something... thanks!


Top
 Profile  
 
 Post subject: I am having this too
PostPosted: Thu Dec 20, 2007 4:08 pm 
Newbie

Joined: Thu Dec 20, 2007 4:03 pm
Posts: 1
This is happening to us as well. I am running version 3.2.4.sp1 against microsoft sql server using their driver.

I am unable to recreate it on demand. It is filling up the disk with log messages in short order.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 5:04 pm 
Newbie

Joined: Thu Dec 29, 2005 12:47 pm
Posts: 4
I reported this in JIRA:
http://opensource.atlassian.com/project ... e/HHH-3006

Please vote for it if you want to have it addressed.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 10:25 pm 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
If understand correctly the Session (EntityManager) object is not thread safe. Only the factories are. To me it looks like as if that assumption has been broken. Very hard to say where the root cause of this problem is. Candidates are: the Spring framework, your application or Hibernate itself.

In your application are you passing the session object to any worker threads 'spawned' by your servlet code?


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.