[hibernate-issues] [Hibernate-JIRA] Created: (OGM-31) ConcurrentModificationException on ArrayList representing the collection

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Apr 6 11:49:59 EDT 2011


ConcurrentModificationException on ArrayList representing the collection 
-------------------------------------------------------------------------

                 Key: OGM-31
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/OGM-31
             Project: Hibernate OGM
          Issue Type: Bug
          Components: core
            Reporter: Emmanuel Bernard


Several instances can access the collection and try and update things. Since the underlying implementation is a simple ArrayList, you can get ConcurrentModificationException if someone reads it while someone else update it.

{code}
Exception in thread "pool-5-thread-2" java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
	at java.util.AbstractList$Itr.next(AbstractList.java:343)
	at org.hibernate.ogm.util.impl.PropertyMetadataProvider.findMatchingTuple(PropertyMetadataProvider.java:137)
	at org.hibernate.ogm.persister.Dehydrator.doRemovePropertyMetadata(Dehydrator.java:219)
	at org.hibernate.ogm.persister.Dehydrator.dehydrate(Dehydrator.java:140)
	at org.hibernate.ogm.persister.OgmEntityPersister.dehydrate(OgmEntityPersister.java:784)
	at org.hibernate.ogm.persister.OgmEntityPersister.update(OgmEntityPersister.java:747)
	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)
	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
	at pt.ist.fenixframework.example.bankbench.hib.HibTxSystem.doIt(HibTxSystem.java:85)
	at pt.ist.fenixframework.example.bankbench.TxCommand.run(TxCommand.java:14)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)
{code}

Problem:
 - the collection should be copied on read and that's not the case
 - the proper approach is to wrap it as an AtomicMap to benefit from the "diff" change
 - longer term, we need the merge on conflict policy in Infinispan.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list