[infinispan-issues] [JBoss JIRA] (ISPN-6407) java.io.UTFDataFormatException while putting to cache using cacheManager.getCache() over javascript

Anna Manukyan (JIRA) issues at jboss.org
Fri Mar 18 13:05:00 EDT 2016


Anna Manukyan created ISPN-6407:
-----------------------------------

             Summary: java.io.UTFDataFormatException while putting to cache using cacheManager.getCache() over javascript
                 Key: ISPN-6407
                 URL: https://issues.jboss.org/browse/ISPN-6407
             Project: Infinispan
          Issue Type: Bug
          Components: Remote Protocols
            Reporter: Anna Manukyan
            Assignee: Galder Zamarreño


The following exception is thrown while execution the following javascript in local mode:

{code}
// mode=local,language=javascript,datatype='text/plain; charset=utf-8'
cacheManager.getCache().put("a", "a");
cacheManager.getCache().get("a")

18:00:24,666 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (HotRodServerWorker-7-128) ISPN000136: Error executing command PutKeyValueCommand, writing keys [test-cacheManager.js]: java.io.UTFDataFormatException: Invalid byte
	at org.jboss.marshalling.UTFUtils.readUTFBytes(UTFUtils.java:162)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:285)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
	at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:134)
	at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectFromByteBuffer(AbstractJBossMarshaller.java:112)
	at org.infinispan.commons.marshall.AbstractMarshaller.objectFromByteBuffer(AbstractMarshaller.java:82)
	at org.infinispan.server.hotrod.HotRodTypeConverter.unmarshall(HotRodTypeConverter.scala:38)
	at org.infinispan.server.hotrod.HotRodTypeConverter.boxValue(HotRodTypeConverter.scala:22)
	at org.infinispan.interceptors.compat.BaseTypeConverterInterceptor.visitPutKeyValueCommand(BaseTypeConverterInterceptor.java:86)
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:78)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
	at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:110)
	at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:79)
	at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:43)
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:78)
	at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:335)
	at org.infinispan.cache.impl.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1658)
	at org.infinispan.cache.impl.CacheImpl.putInternal(CacheImpl.java:1107)
	at org.infinispan.cache.impl.CacheImpl.put(CacheImpl.java:1097)
	at org.infinispan.cache.impl.DecoratedCache.put(DecoratedCache.java:540)
	at org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.put(AbstractDelegatingAdvancedCache.java:229)
	at org.infinispan.server.hotrod.CacheDecodeContext.put(CacheDecodeContext.scala:211)
	at org.infinispan.server.hotrod.HotRodDecoder.org$infinispan$server$hotrod$HotRodDecoder$$decodeValue(HotRodDecoder.scala:145)
	at org.infinispan.server.hotrod.HotRodDecoder$$anonfun$decode$1.apply$mcV$sp(HotRodDecoder.scala:55)
	at org.infinispan.server.hotrod.HotRodDecoder.wrapSecurity(HotRodDecoder.scala:224)
	at org.infinispan.server.hotrod.HotRodDecoder.decode(HotRodDecoder.scala:50)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:370)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:168)
	at org.infinispan.server.hotrod.HotRodDecoder.org$infinispan$server$core$transport$StatsChannelHandler$$super$channelRead(HotRodDecoder.scala:32)
	at org.infinispan.server.core.transport.StatsChannelHandler$class.channelRead(StatsChannelHandler.scala:32)
	at org.infinispan.server.hotrod.HotRodDecoder.channelRead(HotRodDecoder.scala:32)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
	at java.lang.Thread.run(Thread.java:745)
{code}

If the javascript is changed to be: 
{code}
// mode=local,language=javascript,datatype='text/plain; charset=utf-8'
cache.put("a", "a");
cache.get("a")
{code}

then everything works fine. 

The test verifying this use case is: 
{code}
  it('can execute a script remotely to get node address from cacheManager', function(done) {
    Promise.all([client, readFile('spec/utils/test-cacheManager.js')])
        .then(function(vals) {
          var c = vals[0];
          return c.addScript('test-cacheManager.js', vals[1].toString())
              .then(function() { return c; } );
        })
        .then(t.assert(t.exec('test-cacheManager.js'),
                       t.toBe('a')))
        .catch(failed(done)).finally(done);
  });
{code}



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



More information about the infinispan-issues mailing list