[infinispan-issues] [JBoss JIRA] (HRJS-13) Cache entry is not available in JS client while putting it directly from javascript which is executed over JS client

Galder Zamarreño (JIRA) issues at jboss.org
Tue May 24 06:55:03 EDT 2016


     [ https://issues.jboss.org/browse/HRJS-13?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Galder Zamarreño resolved HRJS-13.
----------------------------------
    Fix Version/s: 0.3.0
       Resolution: Done


> Cache entry is not available in JS client while putting it directly from javascript which is executed over JS client
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HRJS-13
>                 URL: https://issues.jboss.org/browse/HRJS-13
>             Project: Infinispan Javascript client
>          Issue Type: Bug
>    Affects Versions: 0.2.0
>            Reporter: Anna Manukyan
>            Assignee: Galder Zamarreño
>             Fix For: 0.3.0
>
>
> When data is put into the cache while javascript execution on the server over JS Client, i.e. the data is put into the cache in executable js file, then the put data is not readable from the client itself. 
> For example, if the https://github.com/infinispan/js-client/blob/master/spec/tests.js files execPutGet function is changed this way: 
> {code}
> exports.execPutGet = function(path, prefix, client, expectFun) {
>   return function(done) {
>     var scriptName = prefix + '-typed-put-get.js';
>     var params = {k: prefix + '-typed-key', v: prefix + '-typed-value'};
>     client
>       .then(t.loadAndExec(path, scriptName))
>       .then(t.assert(t.exec(scriptName, params), expectFun))
>         .then(t.assert(t.get(prefix + "-typed-key"), t.toBe(prefix + "-typed-value")))
>       /*.then(function(cli) {
>           return cli.iterator(1).then(
>               function(it) {
>                   function loop(promise, fn) {
>                       // Simple recursive loop over iterator's next() call
>                       return promise.then(fn).then(function (entry) {
>                           return !entry.done ? loop(it.next(), fn) : entry.value;
>                       });
>                   }
>                   return loop(it.next(), function (entry) {
>                       console.log('iterator.next()=' + JSON.stringify(entry));
>                       return entry;
>                   });
>               }
>           )
>                   })*/
>       .catch(t.failed(done)).finally(done);
>   }
> };
> {code}
> then the assertion will fail with error: 
> {{Expected undefined to be 'dist-cluster-typed-value'.}}
> If you will comment the line with get, and uncomment the iterator part, then the following exception is thrown on the server side: 
> {code}
> 16:36:19,785 ERROR [org.infinispan.server.hotrod.HotRodEncoder] (HotRodServerWorker-8-5) ISPN005022: Exception writing response with messageId=77: java.lang.ClassCastException: java.lang.String cannot be cast to [B
> 	at org.infinispan.server.hotrod.Encoder2x$$anonfun$writeResponse$9.apply(Encoder2x.scala:364)
> 	at org.infinispan.server.hotrod.Encoder2x$$anonfun$writeResponse$9.apply(Encoder2x.scala:343)
> 	at scala.collection.immutable.List.foreach(List.scala:381)
> 	at org.infinispan.server.hotrod.Encoder2x$.writeResponse(Encoder2x.scala:343)
> 	at org.infinispan.server.hotrod.HotRodEncoder.encode(HotRodEncoder.scala:45)
> 	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:619)
> 	at io.netty.channel.AbstractChannelHandlerContext.access$1800(AbstractChannelHandlerContext.java:32)
> 	at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:904)
> 	at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:956)
> 	at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:889)
> 	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
> 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:374)
> 	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
> 	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}
> Seems that the data which is put from the executable js (no matter whether the data which is put is passed as a parameter or was just written in the js itself), is stored in the cache as a byte. And the get operation directly from that script works, but from client itself doesn't. 
> The issue appears for both local and clustered modes.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the infinispan-issues mailing list