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

DefaultCacheManager.getDefaultCacheConfiguration() gives a wrong value for the consistent hash when it is not set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 5.1.0.CR4
    • 5.1.0.CR2
    • Core
    • None

    Description

      Since I upgraded my code to use the new configuration object I realized that the starting time was much slower, after a deeper investigation I realized that the application was stuck at BaseStateTransferManagerImpl.waitForJoinToComplete() because the latch was not released due to the following exception:

      java.lang.ClassCastException: org.infinispan.remoting.transport.jgroups.JGroupsAddress cannot be cast to org.infinispan.remoting.transport.TopologyAwareAddress
      	at org.infinispan.distribution.ch.TopologyAwareConsistentHash.setCaches(TopologyAwareConsistentHash.java:79)
      	at org.infinispan.distribution.ch.ConsistentHashHelper.createConsistentHash(ConsistentHashHelper.java:114)
      	at org.infinispan.statetransfer.ReplicatedStateTransferManagerImpl.createConsistentHash(ReplicatedStateTransferManagerImpl.java:56)
      	at org.infinispan.statetransfer.BaseStateTransferManagerImpl.prepareView(BaseStateTransferManagerImpl.java:310)
      	at org.infinispan.cacheviews.CacheViewsManagerImpl.handlePrepareView(CacheViewsManagerImpl.java:463)
      	at org.infinispan.cacheviews.CacheViewsManagerImpl.clusterPrepareView(CacheViewsManagerImpl.java:300)
      	at org.infinispan.cacheviews.CacheViewsManagerImpl.clusterInstallView(CacheViewsManagerImpl.java:249)
      	at org.infinispan.cacheviews.CacheViewsManagerImpl$ViewInstallationTask.call(CacheViewsManagerImpl.java:850)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	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)
      

      Then I compared the old configuration with the new configuration and realized that org.infinispan.distribution.ch.TopologyAwareConsistentHash was wrongly added to my configuration as consistent hash. That is actually because when I call DefaultCacheManager.getDefaultCacheConfiguration(), it internally calls LegacyConfigurationAdaptor.adapt which calls legacy.getConsistentHashClass() to know if a hash class is set but in practice it cannot be null if it is null it sets a default value but since the global configuration is null it is set to org.infinispan.distribution.ch.TopologyAwareConsistentHash which is not what is expected. See below the corresponding code:

         public String getConsistentHashClass() {
            if (clustering.hash.consistentHashClass == null) {
               clustering.hash.consistentHashClass = globalConfiguration == null || globalConfiguration.hasTopologyInfo() ? TopologyAwareConsistentHash.class.getName() : DefaultConsistentHash.class.getName();
            }
            return clustering.hash.consistentHashClass;
         }
      

      Attachments

        Activity

          People

            manik_jira Manik Surtani (Inactive)
            nfilotto Nicolas Filotto (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: