Redisson: Unhandled DecoderExceptions deplete Netty pool

Created on 6 Apr 2018  路  4Comments  路  Source: redisson/redisson

Our web application is writing an object using Redisson 3.6.4 (Jackson codec) which Jackson cannot deserialise for whatever reason. On attempting to read the object, Redisson fails on the first few attempts and throws a DecoderException as expected. However, the following message is seen from Netty:

Apr 06, 2018 11:54:28 AM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('I' (code 73)): was expecting double-quote to start field name
 at [Source: io.netty.buffer.ByteBufInputStream@71350fef; line: 1, column: 3]
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:422)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
...

After a few attempts (depending on size of Redisson connection pool), all connections are depleted. At this point Redisson is unable to execute any more commands regardless of validity.

I have created a barebones test case to demonstrate the problem: https://github.com/petenattress/redisson-test/blob/master/src/main/java/com/pete/RedissonTest.java

You can checkout and run with ./gradle run (assuming Redis is running locally). See how the first few read attempts fail immediately, but the thrown execption changes from RedisException to RedisTimeoutException and the RedissonClient cannot execute any more commands.

bug

Most helpful comment

Fixed! Thanks for report

All 4 comments

Hi! StringCodec is not compatible with JsonJacksonCodec

Sorry @mrniko - that's not the problem I'm reporting. I am using StringCodec to deliberately write some invalid JSON and demonstrate the pool depletion bug in my test case. In my actual code, both read and write are using JsonJacksonCodec.

Sorry, my mistake I'll investigate it more closely. Thank you!

Fixed! Thanks for report

Was this page helpful?
0 / 5 - 0 ratings