When java.util.concurrent.CancellationException happens?

1,375 views
Skip to first unread message

mykev...@gmail.com

unread,
Mar 24, 2017, 2:14:10 PM3/24/17
to lettuce-redis-client-users
Hello,

I've posted a question https://groups.google.com/forum/#!topic/lettuce-redis-client-users/yks37yodyeE and I got another question.  I also get the following error some times.  What would that mean?  Redis commands fails when I get this error.

java.util.concurrent.CancellationException
at java.util.concurrent.CompletableFuture.cancel(CompletableFuture.java:2263)
at com.lambdaworks.redis.protocol.AsyncCommand.cancel(AsyncCommand.java:121)
at com.lambdaworks.redis.protocol.AsyncCommand.cancel(AsyncCommand.java:155)
at com.lambdaworks.redis.protocol.CommandWrapper.cancel(CommandWrapper.java:60)
at com.lambdaworks.redis.protocol.CommandHandler.cancelCommands(CommandHandler.java:826)
at com.lambdaworks.redis.protocol.CommandHandler.channelUnregistered(CommandHandler.java:155)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:191)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:177)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelUnregistered(AbstractChannelHandlerContext.java:170)
at io.netty.channel.ChannelInboundHandlerAdapter.channelUnregistered(ChannelInboundHandlerAdapter.java:53)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:191)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:177)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelUnregistered(AbstractChannelHandlerContext.java:170)
at io.netty.channel.ChannelInboundHandlerAdapter.channelUnregistered(ChannelInboundHandlerAdapter.java:53)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:191)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:177)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelUnregistered(AbstractChannelHandlerContext.java:170)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelUnregistered(DefaultChannelPipeline.java:1312)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:191)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:177)
at io.netty.channel.DefaultChannelPipeline.fireChannelUnregistered(DefaultChannelPipeline.java:826)
at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:752)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)


Thanks in advance!
Kevin

Mark Paluch

unread,
Mar 24, 2017, 3:26:04 PM3/24/17
to lettuce-redis-client-users, mykev...@gmail.com
This specific cancellation means that there were commands queued (not yet sent to Redis) and the connection was closed.

mykev...@gmail.com

unread,
Mar 24, 2017, 5:33:29 PM3/24/17
to lettuce-redis-client-users, mykev...@gmail.com
Thank you for the explanation.

fredtt...@gmail.com

unread,
Nov 29, 2017, 3:45:44 PM11/29/17
to lettuce-redis-client-users
 io.netty.util.concurrent.SingleThreadEventExecutor$5.run

vkc12uec

unread,
Feb 25, 2019, 6:59:44 PM2/25/19
to lettuce-redis-client-users
Hi MarkP,

So what is the solution to this problem? I am seeing many error logs in my application using lettuce with same stacktrace. Do i need to increase threads or look why connection was closed? any hints?

mpa...@pivotal.io

unread,
Feb 26, 2019, 2:37:51 AM2/26/19
to lettuce-redis-client-users
The cause is that a connection is closed. So an apparent solution can be: Do not close your connection while you run commands.

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