2013-08-19 67 views
0

當我的netty服務器處於重負載狀態時,出現異常。 (使用LOIC等進行測試)我想知道我做錯了什麼,或者它是HttpObjectAggregator中的一個錯誤。Netty 4在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: [email protected] 
    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) 

回答

2

很有可能您在處理後忘記了發佈消息。你叫它release()嗎?

+0

嗯,謝謝你的回答,我有一些問題。我已經通過在下一個處理程序中調用釋放來修復它,但我不能100%確定它是否正確。我何時應該調用釋放方法?完成所有讀取/處理操作後?我正在使用FullHttpRequest並在驗證後發佈它,即使在發佈後我也可以毫無問題地進行工作,那麼可以,或者我應該在所有處理之後發佈它? –

+0

全部處理後發佈 –