IllegalStateException writing to Redis

497 views
Skip to first unread message

Daniel López

unread,
Aug 5, 2016, 2:48:40 AM8/5/16
to lettuce-redis-client-users
Hi,
We had yesterday some kind of hiccup when writing to Redis, and even though we are still investigating what might have caused it, the error being thrown is not telling us much and we wonder if it might ring a bell for you :).

The important pieces of the stack trace are:
...
Caused by: com.lambdaworks.redis.RedisException: java.lang.IllegalStateException at com.lambdaworks.redis.LettuceFutures.await(LettuceFutures.java:106) at com.lambdaworks.redis.LettuceFutures.awaitOrCancel(LettuceFutures.java:74) at com.lambdaworks.redis.cluster.StatefulRedisClusterConnectionImpl$ClusterFutureSyncInvocationHandler.handleInvocation(StatefulRedisClusterConnectionImpl.java:343) at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
...
Caused by: java.lang.IllegalStateException at com.lambdaworks.redis.output.CommandOutput.set(CommandOutput.java:63) at com.lambdaworks.redis.protocol.RedisStateMachine.lambda$safeSet$289(RedisStateMachine.java:178) at com.lambdaworks.redis.protocol.RedisStateMachine$$Lambda$115/1445992401.run(Unknown Source) at com.lambdaworks.redis.protocol.RedisStateMachine.safeSet(RedisStateMachine.java:195) at com.lambdaworks.redis.protocol.RedisStateMachine.safeSet(RedisStateMachine.java:178) at com.lambdaworks.redis.protocol.RedisStateMachine.decode(RedisStateMachine.java:118) at com.lambdaworks.redis.protocol.CommandHandler.decode(CommandHandler.java:162) at com.lambdaworks.redis.protocol.CommandHandler.channelRead(CommandHandler.java:141) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:307) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:293) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:307) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:293) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:307) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:293) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:307) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:293) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:840) 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)

Can you think of a circumstance that would throw such exception?
Thanks,
D.

PD: Using Lettuce 4.1.Final against a cluster of Redis

Mark Paluch

unread,
Aug 5, 2016, 3:12:07 AM8/5/16
to lettuce-redis-client-users
Hi Daniel, 

that sort of exceptions can appear if the connection gets out of sync - if a Redis response does not match the expected command response. In that case, lettuce received an integer value and expected something different.

I've seen such exceptions in combination with reconnects. I fixed some issues with lettuce 4.2.1, maybe you want to upgrade the driver. 

Cheers, 
Mark
Reply all
Reply to author
Forward
0 new messages