java.util.ConcurrentModificationException

Terracotta Project Issue Tracker | Sourceforge Tracker | 7 years ago
  1. 0

    I get this intermittently when doing a Cache#flush(): Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList.writeObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source) at java.util.Collections$SynchronizedCollection.writeObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at net.sf.ehcache.store.DiskStore.writeIndex(DiskStore.java:816) at net.sf.ehcache.store.DiskStore.flush(DiskStore.java:573) at net.sf.ehcache.Cache.flush(Cache.java:1509) at com.wiley.wispers.resolvedoi.EHCacheImpl.main(EHCacheImpl.java:655) What seems to be happening is that the expiry thread is kicking in during the DiskStore#writeIndex() call, and, since #writeIndex() doesn't synchronize on the spoolLock, while DiskStore#expireElements() does, this causes a ConcurrentModificationException. It looks like DiskStore#writeIndex() needs some additional synchronization. Work-around: catch exception and retry Cache#flush() operation (presuming the expiry thread runs less frequently than the time taken to persist the cache!). Sourceforge Ticket ID: 2008055 - Opened By: ellispritchard - 1 Jul 2008 17:36 UTC

    Terracotta Project Issue Tracker | 7 years ago | Sourceforge Tracker
    java.util.ConcurrentModificationException
  2. 0

    I get this intermittently when doing a Cache#flush(): Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList.writeObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source) at java.util.Collections$SynchronizedCollection.writeObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at net.sf.ehcache.store.DiskStore.writeIndex(DiskStore.java:816) at net.sf.ehcache.store.DiskStore.flush(DiskStore.java:573) at net.sf.ehcache.Cache.flush(Cache.java:1509) at com.wiley.wispers.resolvedoi.EHCacheImpl.main(EHCacheImpl.java:655) What seems to be happening is that the expiry thread is kicking in during the DiskStore#writeIndex() call, and, since #writeIndex() doesn't synchronize on the spoolLock, while DiskStore#expireElements() does, this causes a ConcurrentModificationException. It looks like DiskStore#writeIndex() needs some additional synchronization. Work-around: catch exception and retry Cache#flush() operation (presuming the expiry thread runs less frequently than the time taken to persist the cache!). Sourceforge Ticket ID: 2008055 - Opened By: ellispritchard - 1 Jul 2008 17:36 UTC

    Terracotta Project Issue Tracker | 7 years ago | Sourceforge Tracker
    java.util.ConcurrentModificationException
  3. 0

    Concurrent modification when persisting workflows

    GitHub | 4 years ago | aschoneveld
    java.util.ConcurrentModificationException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Accessing variable concurrently from two different threads in java

    Stack Overflow | 2 years ago | Nichos
    java.util.ConcurrentModificationException
  6. 0

    ConcurrentModificationException with writeObject

    Stack Overflow | 5 years ago | Baduel
    java.util.ConcurrentModificationException

    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.ArrayList.writeObject()
    2. Java RT
      ObjectOutputStream.writeObject
      1. java.util.ArrayList.writeObject(Unknown Source)
      2. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      3. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      4. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      5. java.lang.reflect.Method.invoke(Unknown Source)
      6. java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
      7. java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      8. java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      9. java.io.ObjectOutputStream.writeObject0(Unknown Source)
      10. java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      11. java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
      12. java.util.Collections$SynchronizedCollection.writeObject(Unknown Source)
      13. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      14. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      15. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      16. java.lang.reflect.Method.invoke(Unknown Source)
      17. java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
      18. java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      19. java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      20. java.io.ObjectOutputStream.writeObject0(Unknown Source)
      21. java.io.ObjectOutputStream.writeObject(Unknown Source)
      21 frames
    3. Ehcache
      Cache.flush
      1. net.sf.ehcache.store.DiskStore.writeIndex(DiskStore.java:816)
      2. net.sf.ehcache.store.DiskStore.flush(DiskStore.java:573)
      3. net.sf.ehcache.Cache.flush(Cache.java:1509)
      3 frames
    4. com.wiley.wispers
      EHCacheImpl.main
      1. com.wiley.wispers.resolvedoi.EHCacheImpl.main(EHCacheImpl.java:655)
      1 frame