Uploaded image for project: 'Hot Rod Native client'
  1. Hot Rod Native client
  2. HRCPP-413

Unable to pass key as argument to remote script execution

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 8.1.1.Final
    • .NET
    • None

    Description

      When trying to execute the following script with the code below, the server throws an exception (the exception is at the bottom).
      Script:

      // mode=local,language=javascript,parameters=[k,v]
      cache.put(k, v)
      cache.get(k)
      

      Invoking code:

      scriptArgs.Add("k", MarshallValue("mykey"));
      scriptArgs.Add("v", MarshallValue("myvalue"));
      byte[] v = testCache.Execute(scriptName, scriptArgs);
      ...
      private string MarshallValue(string v)
      {
           byte[] bv = marshaller.ObjectToByteBuffer(v);
           return System.Text.Encoding.UTF8.GetString(bv);
      }
      

      Server side and client side errors:

      .19:16:05,583 ERROR [org.infinispan.server.hotrod.CacheDecodeContext] (HotRod-ServerWorker-3-2) ISPN005003: Exception reported: org.infinispan.server.hotrod.InvalidMagicIdException: Error reading magic byte or message id: 1
      4:      at org.infinispan.server.hotrod.HotRodDecoder.readHeader(HotRodDecoder.java:202)
      4:      at org.infinispan.server.hotrod.HotRodDecoder.decodeHeader(HotRodDecoder.java:151)
      4:      at org.infinispan.server.hotrod.HotRodDecoder.decode(HotRodDecoder.java:93)
      4:      at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)
      4:      at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      4:      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
      4:      at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
      4:      at org.infinispan.server.core.transport.StatsChannelHandler.channelRead(StatsChannelHandler.java:26)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      4:      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
      4:      at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
      4:      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
      4:      at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
      4:      at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
      4:      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624)
      4:      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559)
      4:      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476)
      4:      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
      4:      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
      4:      at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
      4:      at java.lang.Thread.run(Thread.java:745)
      
      Infinispan.HotRod.Exceptions.HotRodClientException : org.infinispan.server.hotrod.InvalidMagicIdException: Error reading magic byte or message id: 1
      4:    at Infinispan.HotRod.SWIGGen.RemoteByteArrayCache.execute(String name, StringMap args) in Y:\build_windows\swig\RemoteByteArrayCache.cs:line 304
      4:    at Infinispan.HotRod.Impl.RemoteCacheSWIGGenImpl`2.Execute(String scriptName, IDictionary`2 dict) in Y:\src\main\cs\Infinispan\HotRod\Impl\RemoteCacheSWIGImpl.cs:line 257
      

      The reproducer is available here: https://github.com/mgencur/dotnet-client/commit/4c72d9c6a962db01ba27022efe27b25561e76da4

      Attachments

        Issue Links

          Activity

            People

              vrigamon@redhat.com Vittorio Rigamonti
              mgencur Martin Gencur
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: