Netty Memory Leak Error

原创 2015年11月19日 15:52:56

1. Problem

1.1 Exception

java.lang.OutOfMemoryError: GC overhead limit exceeded
        at com.jcraft.jzlib.InfBlocks.<init>(InfBlocks.java:114)
        at com.jcraft.jzlib.Inflate.inflateInit(Inflate.java:181)
        at com.jcraft.jzlib.Inflater.init(Inflater.java:128)
        at com.jcraft.jzlib.Inflater.init(Inflater.java:114)
        at com.jcraft.jzlib.Inflater.init(Inflater.java:98)
        at io.netty.handler.codec.compression.JZlibDecoder.<init>(JZlibDecoder.java:50)
        at io.netty.handler.codec.compression.ZlibCodecFactory.newZlibDecoder(ZlibCodecFactory.java:111)
        at com.**.ClientHandler.messageReceived(ClientHandler.java:96)
        at com.**.ClientHandler.messageReceived(ClientHandler.java:1)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
        at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
        at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254)
        at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
        at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
        at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
        at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
        at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
        at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243)
        at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
        at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
        at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243)
        at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
        at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)


2. Analysis

2.1 Dump Analysis

pool chunk

2. 2 One Client Monitoring

memory leak caused by thread leak? 

noteworthy:

(1) heap size getting smaller

(2) threads number getting larger

(3) some threads in event loop group are in WAITING status.



monitoring-threads-waiting


2.3 Two clients monitoring

Noteworthy: after the second client started, threads number quickly rose up, so the root cause is clear, there are race conditions which leads to dead lock and WAITING threads.

two clients

two clients overnight:

two clients overnight 

Reference:

[1] Netty版本升级血泪史之线程篇. http://www.infoq.com/cn/articles/netty-version-upgrade-history-thread-part/

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

c++ memory leak 检测代码

  • 2014-07-31 04:20
  • 3.10MB
  • 下载

C/C++内存泄露故障(Memory Leak Faults)之简单篇

C/C++内存泄露故障(Memory Leak Faults)之简单篇Demo代码如下:/* FileName: MemoryLeakFaults.cpp Author: ACb0y Cr...
  • ACb0y
  • ACb0y
  • 2011-02-26 22:56
  • 1036

BREW Memory Leak Checker

  • 2011-04-06 18:14
  • 53KB
  • 下载

简单的Memory leak跟踪(四)参考代码、组织和几个问题的讨论

参考代码 摘录了相关的代码,在小生的CSDN资源站里,0分下载,链接如下。 http://download.csdn.net/detail/noslopforever/4568056 转载请...

BREW Memory Leak Checker 20111109

  • 2011-11-09 22:45
  • 217KB
  • 下载

简单的Memory leak跟踪(三) 方案2:Dbghelp

dbghelp这个方案比较复杂,速度也比较慢,不过用在Trace的场合也不算太糟糕。 原理是,dbghelp.lib、dbghelp.h提供了一大堆获取当前调用栈信息(ESP、EBP),并通过这些调...

BREW Memory Leak Checker 20120219

  • 2012-02-19 22:24
  • 325KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)