HttpObjectAggregator上的Netty 4泄漏异常

时间:2013-08-19 06:39:22

标签: java networking netty

我在netty服务器上遇到异常,但是负载很重。 (用LOIC等测试......)我想知道我做错了什么或者它是HttpObjectAggregator中的一个错误。

WARNING: LEAK: ByteBuf was GC'd before being released correctly.  The following stack trace shows where the leaked object was created, rather than where you failed to release it.
io.netty.util.ResourceLeakException: io.netty.buffer.CompositeByteBuf@1c0eeb6
    at io.netty.util.ResourceLeakDetector$DefaultResourceLeak.<init>(ResourceLeakDetector.java:174)
    at io.netty.util.ResourceLeakDetector.open(ResourceLeakDetector.java:116)
    at io.netty.buffer.CompositeByteBuf.<init>(CompositeByteBuf.java:60)
    at io.netty.buffer.Unpooled.compositeBuffer(Unpooled.java:353)
    at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:138)
    at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:50)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:497)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:465)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:359)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:722)

1 个答案:

答案 0 :(得分:2)

您很可能忘记在处理后忘记发布消息。你有没有打电话给release()?