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

X-site replication with functional commands throws NullPointerException

    XMLWordPrintable

Details

    Description

      CacheOperationsTest.testFunctional() checks that some keys do not exist in the cache by calling evalMany on a read-write map, but with a read-only lambda.

      This creates a VersionedRepeatableReadEntry(value=null) in the tx invocation context, and BackupSenderImpl.filterModifications() sends that to the remote site as a PutKeyValueCommand(value=null). On the remote site this is translated as cache.put(key, null), which finally throws a NullPointerException:

      15:18:54,543 WARN  (remote-thread-CacheOperationsTest[REPL_SYNC, tx=true, lockingMode=OPTIMISTIC, 2PC]-NodeD-p40433-t6:[]) [GlobalInboundInvocationHandler] ISPN000071: Caught exception when handling command SingleXSiteRpcCommand{command=PrepareCommand {modifications=[PutKeyValueCommand{key=MagicKey#k2{1910/3D34DA4D/67@CacheOperationsTest[REPL_SYNC, tx=true, lockingMode=OPTIMISTIC, 2PC]-NodeB-4295}, value=null, flags=[], commandInvocationId=CommandInvocation:local:0, putIfAbsent=false, valueMatcher=MATCH_ALWAYS, metadata=EmbeddedMetadata{version=SimpleClusteredVersion{topologyId=0, version=0}}, successful=true, topologyId=-1}, PutKeyValueCommand{key=MagicKey#k0{190E/360DCEC7/18@CacheOperationsTest[REPL_SYNC, tx=true, lockingMode=OPTIMISTIC, 2PC]-NodeA-60870}, value=null, flags=[], commandInvocationId=CommandInvocation:local:0, putIfAbsent=false, valueMatcher=MATCH_ALWAYS, metadata=EmbeddedMetadata{version=SimpleClusteredVersion{topologyId=0, version=0}}, successful=true, topologyId=-1}, PutKeyValueCommand{key=MagicKey#k1{190F/71AF2073/6@CacheOperationsTest[REPL_SYNC, tx=true, lockingMode=OPTIMISTIC, 2PC]-NodeB-4295}, value=null, flags=[], commandInvocationId=CommandInvocation:local:0, putIfAbsent=false, valueMatcher=MATCH_ALWAYS, metadata=EmbeddedMetadata{version=SimpleClusteredVersion{topologyId=0, version=0}}, successful=true, topologyId=-1}], onePhaseCommit=false, retried=false, gtx=GlobalTx:CacheOperationsTest[REPL_SYNC, tx=true, lockingMode=OPTIMISTIC, 2PC]-NodeA-60870:26069, cacheName='___defaultcache', topologyId=-1}}
      java.lang.NullPointerException: Null values are not supported!
      	at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_152]
      	at org.infinispan.cache.impl.CacheImpl.assertValueNotNull(CacheImpl.java:199) ~[classes/:?]
      	at org.infinispan.cache.impl.CacheImpl.assertKeyValueNotNull(CacheImpl.java:204) ~[classes/:?]
      	at org.infinispan.cache.impl.CacheImpl.put(CacheImpl.java:1331) ~[classes/:?]
      	at org.infinispan.cache.impl.DecoratedCache.put(DecoratedCache.java:654) ~[classes/:?]
      	at org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.put(AbstractDelegatingAdvancedCache.java:355) ~[classes/:?]
      	at org.infinispan.cache.impl.EncoderCache.put(EncoderCache.java:425) ~[classes/:?]
      	at org.infinispan.xsite.BaseBackupReceiver$BackupCacheUpdater.visitPutKeyValueCommand(BaseBackupReceiver.java:110) ~[classes/:?]
      	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:67) ~[classes/:?]
      	at org.infinispan.xsite.BaseBackupReceiver$BackupCacheUpdater.replayModifications(BaseBackupReceiver.java:259) ~[classes/:?]
      	at org.infinispan.xsite.BaseBackupReceiver$BackupCacheUpdater.visitPrepareCommand(BaseBackupReceiver.java:155) ~[classes/:?]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:185) ~[classes/:?]
      	at org.infinispan.xsite.BaseBackupReceiver.handleRemoteCommand(BaseBackupReceiver.java:76) ~[classes/:?]
      	at org.infinispan.xsite.SingleXSiteRpcCommand.performInLocalSite(SingleXSiteRpcCommand.java:37) ~[classes/:?]
      	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.runXSiteReplicableCommand(GlobalInboundInvocationHandler.java:126) ~[classes/:?]
      	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.lambda$handleFromRemoteSite$0(GlobalInboundInvocationHandler.java:95) ~[classes/:?]
      

      There's no exception on the local node, maybe because entries with null values are not committed regardless of what their flags say.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: