Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5379

Persistence with stringKeyedJdbcStore throwing ConcurrentModificationException while adding data to cache

    XMLWordPrintable

Details

    Description

      From Dennis Reed:

      A ConcurrentModificationException in the CacheWriter interceptor during a commit.

      java.util.ConcurrentModificationException
      at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953)
      at java.util.LinkedList$ListItr.next(LinkedList.java:886)
      at org.infinispan.interceptors.CacheWriterInterceptor.store(CacheWriterInterceptor.java:210)
      at org.infinispan.interceptors.CacheWriterInterceptor.commitCommand(CacheWriterInterceptor.java:115)

      The code is looping through the modifications associated with the transaction:
      List<WriteCommand> modifications = ctx.getCacheTransaction().getAllModifications();
      ...
      210: for (WriteCommand cacheCommand : modifications) {

      The transaction's modification list is stored as a synchronized list with a comment "we need to synchronize this collection to be able to get a valid snapshot from another thread during state transfer".

      But this thread is not doing state transfer, and I'd assume "get a valid snapshot" wouldn't include modification?

      Is it valid for this list to be modified from another thread (in which case all iterations should be synchronized), or is something modifying it incorrectly?

      Attachments

        Activity

          People

            dberinde@redhat.com Dan Berindei (Inactive)
            dberinde@redhat.com Dan Berindei (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: