1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Solved Memory leak with connection-throttle

Discussion in 'Bugs & Feature Requests' started by Erocs, May 21, 2013.

  1. CivCraft launched it's v2 this week. One of the issues we ran into was a slow memory leak. With hundreds of players attempting to connect, the server would run out of memory in about 6 hours and crash.

    One of the things that the server owner noticed is that the memory increase rate was proportional to "<IP Address> lost connection" messages (not "<Player> lost connection"). This lead us to the connection-throttle setting which by default is set to 4000. This is the only location where that message is logged.

    To check if it was the culprit, yesterday we set connection-throttle to -1 and haven't seen the memory leak since. The server will continue to run with the throttle disabled to further validate the leak originates with that setting.

    Examining the code at https://github.com/EcoCityCraft/Spi...g/spigotmc/netty/NettyNetworkManager.java#L75, it can be seen that if the throttle disconnects a player, the remote channel is closed but the NettyNetworkManager is still setting up and marking the channel as active. This may be the cause of the leak as the upper networking layers may never tear down this object since it is seen marked active. Also the object will never receive any I/O prompting further action as the channel is already closed.

    This server is running CraftBukkit version git-Spigot-869 (MC: 1.5.2) (Implementing API version 1.5.2-R0.2-SNAPSHOT)
     
    • Informative Informative x 1
    • Useful Useful x 1
  2. md_5

    Administrator Developer

    There used to be a return - must have gotten lost.
    However the inactive method would be called still so your analysis isn't actually valid.
    Best way of tackling this is with a heap dump-you sounds like you have the skills to make one. :)
    Also memory leak != garbage collection not kicking in. Likely its not leaking, just building up to a full GC.