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

Clustered Locks with zero-capacity throws ClassCastException

    XMLWordPrintable

    Details

      Description

      When creating a cluster with no explicit clustered-locks configuration, i.e. num_Owners is not defined, a `ClassCastException` is thrown if a zero-capacity node joins the cluster and attempts to use a lock:

      10:10:36,564 ERROR (non-blocking-thread--p2-t2) [org.infinispan.topology.LocalTopologyManagerImpl] ISPN000230: Failed to start rebalance for cache org.infinispan.LOCKS java.util.concurrent.CompletionException: java.lang.ClassCastException: class org.infinispan.distribution.ch.impl.ReplicatedConsistentHash cannot be cast to class org.infinispan.distribution.ch.impl.DefaultConsistentHash (org.infinispan.distribution.ch.impl.ReplicatedConsistentHash and org.infinispan.distribution.ch.impl.DefaultConsistentHash are in unnamed module of loader java.net.URLClassLoader @6d03e736)
          at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:367)
          at java.base/java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:376)
          at java.base/java.util.concurrent.CompletableFuture$UniRelay.tryFire(CompletableFuture.java:1019)
          at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
          at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.accept(ActionSequencer.java:213)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.accept(ActionSequencer.java:179)
          at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
          at java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:883)
          at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2251)
          at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:143)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.run(ActionSequencer.java:227)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.apply(ActionSequencer.java:219)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.apply(ActionSequencer.java:179)
          at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
          at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
          at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassCastException: class org.infinispan.distribution.ch.impl.ReplicatedConsistentHash cannot be cast to class org.infinispan.distribution.ch.impl.DefaultConsistentHash (org.infinispan.distribution.ch.impl.ReplicatedConsistentHash and org.infinispan.distribution.ch.impl.DefaultConsistentHash are in unnamed module of loader java.net.URLClassLoader @6d03e736)
          at org.infinispan.distribution.ch.impl.SyncConsistentHashFactory.union(SyncConsistentHashFactory.java:58)
          at org.infinispan.topology.LocalTopologyManagerImpl.doHandleRebalance(LocalTopologyManagerImpl.java:562)
          at org.infinispan.topology.LocalTopologyManagerImpl.lambda$handleRebalance$16(LocalTopologyManagerImpl.java:531)
          at org.infinispan.topology.LocalTopologyManagerImpl.lambda$orderOnCache$24(LocalTopologyManagerImpl.java:736)
          at org.infinispan.util.concurrent.ActionSequencer.safeNonBlockingCall(ActionSequencer.java:57)
          at org.infinispan.util.concurrent.ActionSequencer.access$400(ActionSequencer.java:32)
          at org.infinispan.util.concurrent.ActionSequencer$SequenceEntry.run(ActionSequencer.java:226)
          ... 8 more
      

      Previously zero-capacity node was not supported with replicated-caches, however this is no longer the case so it should be possible for clustered-locks to work with a replicated cache without defining num_owners.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dan.berindei Dan Berindei
              Reporter:
              ryanemerson Ryan Emerson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: