1

Following is the stack trace:

Created at:
    io.netty.buffer.CompositeByteBuf.<init>(CompositeByteBuf.java:63)
    io.netty.buffer.AbstractByteBufAllocator.compositeDirectBuffer(AbstractByteBufAllocator.java:191)
    io.netty.buffer.AbstractByteBufAllocator.compositeBuffer(AbstractByteBufAllocator.java:169)
    io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:184)
    io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:57)
    io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
    io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
    io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:249)
    io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
    io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
    io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:147)
    io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
    io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1107)
    io.netty.handler.ssl.SslHandler.decode(SslHandler.java:965)
    io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:327)
    io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
    io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
    io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
    io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
    io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
    io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
    io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
    io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
    io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    java.lang.Thread.run(Thread.java:748)

I have used version 4.0.31.Final & even getting same leak in latest version netty-4.1.29.Final as per https://netty.io/downloads.html. Any updates appreciated.

piet.t
  • 11,718
  • 21
  • 43
  • 52
  • Can you post the code where you use this object? When using netty, it is important to call `.close()` on objects containing ByteBuf's, but at the moment, this is not done in your code. – Ferrybig Sep 20 '18 at 11:11
  • I suspect you forgot to call `release()` on a ByteBuf in the last ChannelInboundHandler in your pipeline. Please share your code. – Norman Maurer Sep 20 '18 at 13:25
  • I have a class say ServerHandler which extends ChannelInboundHandlerAdapter & it doesn't contain any ButeBuf objects but it uses FullHttpRequest & instantiates it like FullHttpRequest httpRequest = (FullHttpRequest) msg; where msg is of Object class.So do I need to call httpRequest.clear() ?? – Siddhivinayak Shanbhag Sep 21 '18 at 08:15
  • No you need to call `httpRequest.release()` – Norman Maurer Sep 22 '18 at 16:48

1 Answers1

0

httpRequest.release() seems to work fine. httpRequest is handled in the form of object we need to release that object.