java.util.ConcurrentModificationException

Hibernate JIRA | Emmanuel Bernard | 6 years ago
  1. 0

    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.

    Hibernate JIRA | 6 years ago | Emmanuel Bernard
    java.util.ConcurrentModificationException
  2. 0

    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.

    Hibernate JIRA | 6 years ago | Emmanuel Bernard
    java.util.ConcurrentModificationException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    PartyAutoKickTask throws an Error

    GitHub | 4 years ago | ForeverPVP
    java.util.ConcurrentModificationException

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.ConcurrentModificationException

      No message provided

      at java.util.AbstractList$Itr.checkForComodification()
    2. Java RT
      AbstractList$Itr.next
      1. java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
      2. java.util.AbstractList$Itr.next(AbstractList.java:343)
      2 frames
    3. Hibernate Object Grid Mapper
      PropertyMetadataProvider.findMatchingTuple
      1. org.hibernate.ogm.util.impl.PropertyMetadataProvider.findMatchingTuple(PropertyMetadataProvider.java:137)
      1 frame
    4. org.hibernate.ogm
      OgmEntityPersister.update
      1. org.hibernate.ogm.persister.Dehydrator.doRemovePropertyMetadata(Dehydrator.java:219)
      2. org.hibernate.ogm.persister.Dehydrator.dehydrate(Dehydrator.java:140)
      3. org.hibernate.ogm.persister.OgmEntityPersister.dehydrate(OgmEntityPersister.java:784)
      4. org.hibernate.ogm.persister.OgmEntityPersister.update(OgmEntityPersister.java:747)
      4 frames
    5. Hibernate
      EntityUpdateAction.execute
      1. org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)
      1 frame
    6. Hibernate
      ActionQueue.executeActions
      1. org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      2. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
      3. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
      3 frames
    7. Hibernate
      SessionImpl.managedFlush
      1. org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      2. org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
      3. org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
      4. org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
      4 frames
    8. Hibernate
      JDBCTransaction.commit
      1. org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
      1 frame
    9. pt.ist.fenixframework
      TxCommand.run
      1. pt.ist.fenixframework.example.bankbench.hib.HibTxSystem.doIt(HibTxSystem.java:85)
      2. pt.ist.fenixframework.example.bankbench.TxCommand.run(TxCommand.java:14)
      2 frames
    10. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      3. java.lang.Thread.run(Thread.java:680)
      3 frames