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

Conditional commands with Flag.IGNORE_RETURN_VALUES cause NPEs

    XMLWordPrintable

    Details

      Description

      The root cause of the exception below is:

      • when Flag.IGNORE_RETURN_VALUES is used the node on which the operation is executed returns NULL
      • the operation being conditional return boolean to the user. The null above is unboxed to a boolean which causes a NPE

      The solution is to ignore the Flag.IGNORE_RETURN_VALUES for conditional operations (remove(k, prevValue) replace(k, prevValue,newValue)) and return the result of the operation: this is a boolean, so the network payload is the same as for null.

      14:07:57,149 WARN [org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher] (Incoming-2,shared=tcp) ISPN000071: Caught exception when handling command SingleRpcCommand{cacheName='default', command=ReplaceCommand{key=name, oldValue=[B0x42656c61..(4), newValue=[B0x42656c61..(4), metadata=MimeMetadata(text/plain; charset=UTF-8,-1,SECONDS,-1,SECONDS,null,null), flags=null, successful=true, ignorePreviousValue=false}}: java.lang.NullPointerException
      at org.infinispan.CacheImpl.replaceInternal(CacheImpl.java:880)
      at org.infinispan.CacheImpl.replace(CacheImpl.java:871)
      at org.infinispan.DecoratedCache.replace(DecoratedCache.java:551)
      at org.infinispan.xsite.BackupReceiverImpl$BackupCacheUpdater.visitReplaceCommand(BackupReceiverImpl.java:113)
      at org.infinispan.commands.write.ReplaceCommand.acceptVisitor(ReplaceCommand.java:76)
      at org.infinispan.xsite.BackupReceiverImpl.handleRemoteCommand(BackupReceiverImpl.java:76)
      at org.infinispan.xsite.BackupReceiverRepositoryImpl.handleRemoteCommand(BackupReceiverRepositoryImpl.java:87)
      at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.executeCommandFromRemoteSite(CommandAwareRpcDispatcher.java:255)
      at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.handle(CommandAwareRpcDispatcher.java:230)
      at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:460) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:377) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:247) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:665) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.blocks.mux.MuxUpHandler.up(MuxUpHandler.java:130) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.JChannel.up(JChannel.java:719) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1008) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.protocols.relay.RELAY2.deliver(RELAY2.java:607) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.protocols.relay.RELAY2.route(RELAY2.java:507) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.protocols.relay.RELAY2.handleMessage(RELAY2.java:482) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.protocols.relay.RELAY2.handleRelayMessage(RELAY2.java:463) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.protocols.relay.Relayer$Bridge.receive(Relayer.java:302) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.JChannel.up(JChannel.java:749) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]
      at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1012) [jgroups-3.3.0.CR2.jar:3.3.0.CR2]

        Attachments

          Activity

            People

            Assignee:
            mircea.markus Mircea Markus (Inactive)
            Reporter:
            mircea.markus Mircea Markus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: