-->
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 when query on a unix box
PostPosted: Sat Nov 17, 2012 7:34 pm 
Newbie

Joined: Thu Nov 15, 2012 9:54 pm
Posts: 4
Dear,

I got a problem when querying. The weird problem is that the error happens on Unix box but not on a window box.



15:28:54,103 ERROR [[AjaxMethodOfInstructionByCourseRequirementServlet]] Servlet.service() for servlet AjaxMethodOfInstructionByCourseRequirementServlet threw exception
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at org.hibernate.pretty.Printer.toString(Printer.java:113)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:120)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at com.cmaps.core.persist.dao.InstructionalMethodDao.getUniversalList(InstructionalMethodDao.java:35)
at com.cmaps.servlet.AjaxMethodOfInstructionByCourseRequirementServlet.doAjax(AjaxMethodOfInstructionByCourseRequirementServlet.java:40)
at com.cmaps.servlet.AjaxServlet.doGet(AjaxServlet.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
15:29:16,210 INFO [STDOUT] 443449 [Timer-1] INFO com.mchange.v2.resourcepool.BasicResourcePool - A checked-out resource is overdue, and will be destroyed: com.mchange.v2.c3p0.impl.NewPooledConnection@27f07e81


Top
 Profile  
 
 Post subject: Re: ConcurrentModificationException when query on a unix box
PostPosted: Mon Nov 19, 2012 5:33 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Which version of hibernate do you use?


Top
 Profile  
 
 Post subject: Re: ConcurrentModificationException when query on a unix box
PostPosted: Wed Dec 05, 2012 12:46 pm 
Newbie

Joined: Thu Nov 15, 2012 9:54 pm
Posts: 4
Answer: hibernate3.jar

Sometimes, when I do query.list(), I got the same problem (ConcurrentModificationException)
It only happens on unix box, not on window os.


Top
 Profile  
 
 Post subject: Re: ConcurrentModificationException when query on a unix box
PostPosted: Fri Dec 07, 2012 10:23 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Looks like you are having more threads running concurrently operating on the same hiberante session.
This would mean a incorrect use of Hibernate.
While the thread relative to your stacktrace was iterating a hashmap for read-only purpose (toString method),
another thread modified that hashmap causing the exception you report here.

Some year ago I had the same problem, when there sometimes were longterm blocking resources on database (locks) while flushing.
This caused a long client-server-roundtrip and after a couple of time (timeout) our proxy did resend the same request again.
This caused in tomcat the start of a second worker-tread acting on the same hibernate session as the other one which still waited the end of flushing. After the lock on database dissappeared, there were race-conditionsbetween the two threads (= 2 threads doing the same in non-thread safe code) causing exceptions like the one you reported.


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.