Timofey Gorshkov
Timofey Gorshkov

Reputation: 5125

Netty 4.0 EncoderException loss

I'm using Netty 4.0.32.Final.

When NPE appears in my codec with such a stack trace:

my.Codec.encode(Codec.java:27)
io.netty.handler.codec.ByteToMessageCodec$Encoder.encode(ByteToMessageCodec.java:168)
io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
io.netty.handler.codec.ByteToMessageCodec.write(ByteToMessageCodec.java:108)
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633)
io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32)
io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908)
io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:960)
io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893)
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
java.lang.Thread.run(Thread.java:745)

It vanishes somewhere. So that I couldn't handle it in another Hanler's exceptionCaught method.

Upvotes: 0

Views: 116

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

It's an "outbound exception" and so will not show up in exceptionCaught(...). exceptionCaught(...) is only notified for inbound exceptions. The ChannelFuture of the previous write(...) operation will be failed with the exception.

Upvotes: 1

Related Questions