Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

Memory sampling results

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.

like image 923
Blake Beaupain Avatar asked Jul 13 '14 20:07

Blake Beaupain


1 Answers

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

like image 160
Prim Avatar answered Oct 09 '22 17:10

Prim