[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
Wed Apr 20 05:07:01 EDT 2016
[ https://issues.jboss.org/browse/ISPN-6407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194312#comment-13194312 ]
Anna Manukyan edited comment on ISPN-6407 at 4/20/16 5:06 AM:
--------------------------------------------------------------
Galder, I have tried out the assumption that you have made in the pull request regarding the limitation of String size which may lead to this issue, and you are right:
the issue happens if the String, which size is >= 128, is inserted into "___script_cache" cache using client's addScript method.
By the way, if I am trying to insert some string to "___script_cache" cache directly without calling addScript method (which may be the case - e.g. tested for Hotrod client and works fine), then I am getting the following exception:
{code}
10:22:40,142 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (HotRodServerWorker-5-69) ISPN000136: Error executing command PutKeyValueCommand, writing keys [[B at 7d7a534f]: java.io.IOException: Unsupported protocol version 107
at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1249)
at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:128)
at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectFromByteBuffer(AbstractJBossMarshaller.java:109)
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.boxKey(HotRodTypeConverter.scala:20)
at org.infinispan.interceptors.compat.BaseTypeConverterInterceptor.visitPutKeyValueCommand(BaseTypeConverterInterceptor.java:81)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.doInvokeNextSync(BaseSequentialInvocationContext.java:263)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.forkInvocationSync(BaseSequentialInvocationContext.java:90)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
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:77)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.doInvokeNextSync(BaseSequentialInvocationContext.java:263)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.invokeSync(BaseSequentialInvocationContext.java:253)
at org.infinispan.interceptors.impl.SequentialInterceptorChainImpl.invoke(SequentialInterceptorChainImpl.java:240)
at org.infinispan.cache.impl.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1685)
at org.infinispan.cache.impl.CacheImpl.putInternal(CacheImpl.java:1219)
at org.infinispan.cache.impl.CacheImpl.put(CacheImpl.java:1209)
at org.infinispan.cache.impl.DecoratedCache.put(DecoratedCache.java:526)
at org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.put(AbstractDelegatingAdvancedCache.java:236)
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:244)
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:131)
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:112)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
{code}
was (Author: amanukyan):
Galder, I have tried out the assumption that you have made in the pull request regarding the limitation of String size which may lead to this issue, and you are right:
the issue happens if the String, which size is > 128, is inserted into "___script_cache" cache using client's addScript method.
By the way, if I am trying to insert some string to "___script_cache" cache directly without calling addScript method (which may be the case - e.g. tested for Hotrod client and works fine), then I am getting the following exception:
{code}
10:22:40,142 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (HotRodServerWorker-5-69) ISPN000136: Error executing command PutKeyValueCommand, writing keys [[B at 7d7a534f]: java.io.IOException: Unsupported protocol version 107
at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1249)
at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:128)
at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectFromByteBuffer(AbstractJBossMarshaller.java:109)
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.boxKey(HotRodTypeConverter.scala:20)
at org.infinispan.interceptors.compat.BaseTypeConverterInterceptor.visitPutKeyValueCommand(BaseTypeConverterInterceptor.java:81)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.doInvokeNextSync(BaseSequentialInvocationContext.java:263)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.forkInvocationSync(BaseSequentialInvocationContext.java:90)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
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:77)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.doInvokeNextSync(BaseSequentialInvocationContext.java:263)
at org.infinispan.interceptors.impl.BaseSequentialInvocationContext.invokeSync(BaseSequentialInvocationContext.java:253)
at org.infinispan.interceptors.impl.SequentialInterceptorChainImpl.invoke(SequentialInterceptorChainImpl.java:240)
at org.infinispan.cache.impl.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1685)
at org.infinispan.cache.impl.CacheImpl.putInternal(CacheImpl.java:1219)
at org.infinispan.cache.impl.CacheImpl.put(CacheImpl.java:1209)
at org.infinispan.cache.impl.DecoratedCache.put(DecoratedCache.java:526)
at org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.put(AbstractDelegatingAdvancedCache.java:236)
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:244)
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:131)
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:112)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
{code}
> 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}
> UPDATE:
> The exception is thrown not only in case of cacheManager usage. It is also thrown while using marshaller, or adding a simple line in the executed script like:
> var a = null;
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the infinispan-issues
mailing list