Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-888

ConcurrentModificationException in LettuceConverters

    Details

      Description

      We're using Spring Data Redis 2.1.2.RELEASE for caching various objects in Redis cluster. Redis cluster has 3 master and 3 slave nodes.

      And every hour we get 3 or 4 exceptions like this:

      [https-jsse-nio-8080-exec-8] ERROR ? - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.connection.ClusterCommandExecutionFailureException: nested exception is java.util.ConcurrentModificationException] with root cause
      java.util.ConcurrentModificationException: null
          at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
          at java.util.ArrayList$Itr.next(ArrayList.java:851)
          at org.springframework.data.redis.connection.lettuce.LettuceConverters$1.convert(LettuceConverters.java:226)
          at org.springframework.data.redis.connection.lettuce.LettuceConverters$1.convert(LettuceConverters.java:217)
          at org.springframework.data.redis.connection.lettuce.LettuceConverters.partitionsToClusterNodes(LettuceConverters.java:716)
          at org.springframework.data.redis.connection.lettuce.LettuceClusterTopologyProvider.getTopology(LettuceClusterTopologyProvider.java:53)
          at org.springframework.data.redis.connection.ClusterCommandExecutor.lookupNode(ClusterCommandExecutor.java:169)
          at org.springframework.data.redis.connection.ClusterCommandExecutor.executeCommandOnSingleNode(ClusterCommandExecutor.java:138)
          at org.springframework.data.redis.connection.ClusterCommandExecutor.executeCommandOnSingleNode(ClusterCommandExecutor.java:123)
          at org.springframework.data.redis.connection.ClusterCommandExecutor.lambda$executeCommandAsyncOnNodes$0(ClusterCommandExecutor.java:212)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
      

      It looks like the problem is that access to io.lettuce.core.cluster.models.partitions.Partitions#getPartitions should be synchronized (at least JavaDoc for getPartitions says so), but in LettuceConverter this method is used in for-each loop without any synchronization. 

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              Asapin Vladimir Kuzmin
              Last updater:
              Christoph Strobl
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: