Logistics Pipes

Logistics Pipes

13M Downloads

Memory Leak - Satellite Pipes?

Tayrtahn opened this issue ยท 5 comments

commented

I've spent the last couple of weeks trying to track down a particularly pesky memory leak on my server. I've ruled out a number of other possible sources and signs are pointing to Logistics Pipes as the culprit.

The observable effect is that the server's memory usage slowly increases over time (even when no one is online) until the garbage collector starts to thrash, causing huge lag for anyone playing. After a while of this, Java crashes on the server due to a lack of available heap space. Increasing the available heap size only delays the problem; it still fills up eventually.

I've made a heap dump of the server at the point of the crash and taken a look at it with the Eclipse Memory Analyzer. The Leak Suspects analysis points to Logistics Pipes, and with good reason: "The class "logisticspipes.pipes.PipeItemsSatelliteLogistics", loaded by "net.minecraft.launchwrapper.LaunchClassLoader @ 0x69383e18", occupies 430,451,048 (50.00%) bytes. The memory is accumulated in one instance of "java.util.HashMap$Node[]" loaded by ""."

I'm not great at using the tool, but it looks like that HashMap contains over 8,000 entries. I have the only LP setup on the server, and I'm using a whopping 3 satellite pipes (to provide fuel to furnaces). I have maybe a few dozen logistics pipes in my setup, so I can't see how I could be overloading the system.

Version information:
Minecraft 1.7.10
Forge 10.13.4.1448
Buildcraft 7.0.21
Logistics Pipes 0.9.2.33

I'm happy to provide more information from the heap dump as needed, including uploading the whole thing if that's helpful.

commented

Are your satellite pipes chunk loaded?

Internal reference: Set<Object> weakHashSet = Collections.newSetFromMap(new WeakHashMap<Object, Boolean>());

commented

Hm, not to my knowledge, unless there are things that act as chunkloaders that I'm not aware of. The system is hooked up to a Forestry MultiFarm growing apple oaks, and I have a supplier pipe keeping a Railcraft boiler running. The only explicit chunkloader in the world is a Railcraft Personal Anchor, but it's well out of range. I'll take a look with a chunkloader visualizer and see if I'm missing something.

commented

And that's probably the reason for your problem. LP doesn't like to be loaded and unloaded. It's always best to chunkload every part of your lp system.
Never the less, we should probably fix the memory leak with the fix I referneced above.

commented

Oh, good to know! I'll add a chunkloader into the area later today and see how it goes.

commented

Adding a World Anchor to the area seems to have solved the problem, or at least greatly improved things. The server has been running for a few days now without issue. Thanks for the help!