简体   繁体   中英

Netty 4.0.19.Final Memory Leak with io.netty.channel.ChannelOutboundBuffer$Entry

I seem to be experiencing recurring memory issues with Netty 4. My app queries Minecraft servers for information and updates a database with that information. Currently it creates 300 connection requests every 10 seconds and sends packets if those connections are successfully completed.

A previous iteration of my querying app used Netty 3.2.5 and it ran for months on end nonstop with no issues. With Netty 4 however, it only runs a few hours before exhausting all available resources. Here is a screenshot of the memory sampling over a JMX connection.

内存采样结果

As we can see, io.netty.channel.ChannelOutboundBuffer$Entry is using up a large amount of memory. Any idea how to go about troubleshooting this? I'm available to provide code if you guys need. Thanks!

Stephen C: This is not a duplicate of "How to find a Java memory leak". This has to do with Netty specifically, and I'm not trying to find out how to discover a memory leak - I've already discovered one with Netty. I have re-posted my question so that I have a chance of getting an answer.

It's probably due to a wrong usage of reference counted object (a new principle introduced in Netty 4). Your channel doesn't correctly release an object.

You can use -Dio.netty.leakDetectionLevel=paranoid to activate an auto memory leak detection in Netty.

See the documentation here: http://netty.io/wiki/reference-counted-objects.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM