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

Cache.clear() raises a NPE if CacheMode is DIST_SYNC and NumOwners is set to 1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.0.0.CR4
    • 4.0.0.CR3
    • None
    • None
    • Low

      This fragment:

      GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.DIST_SYNC);
      config.setNumOwners(1); // no redundancy

      CacheManager cacheManager = new DefaultCacheManager(gc, config);
      Cache cache = cacheManager.getCache();

      cache.put("key", "value");

      cache.clear();
      assert cache.isEmpty();

      raises a NullPointerException at cache.clear() invokation.
      It works correctly both using other cache modes (LOCAL, REPL and INVALIDATION) or avoiding to set config.setNumOwners to 1.

      The stacktrace is:

      java.lang.NullPointerException
      at org.infinispan.interceptors.DistributionInterceptor.isSingleOwnerAndLocal(DistributionInterceptor.java:317)
      at org.infinispan.interceptors.DistributionInterceptor.handleWriteCommand(DistributionInterceptor.java:276)
      at org.infinispan.interceptors.DistributionInterceptor.visitClearCommand(DistributionInterceptor.java:180)
      at org.infinispan.commands.write.ClearCommand.acceptVisitor(ClearCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.LockingInterceptor.visitClearCommand(LockingInterceptor.java:169)
      at org.infinispan.commands.write.ClearCommand.acceptVisitor(ClearCommand.java:58)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:132)
      ....

            manik_jira Manik Surtani (Inactive)
            mferrante_jira Marco Ferrante (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: