Industrial Revolution

Industrial Revolution

5M Downloads

[BUG] Memory Leak from Pump and Tank/Fluid Infuser (when holding fluid)

Gadsoc opened this issue ยท 7 comments

commented

Description:

Memory leak caused by the following items:

  • Pump
    • No memory leak occurs when initially placed in the world. Once the pump is connected to power, extends down to the fluid, and begins selecting blocks to consume the memory leak starts. Disconnecting the pump from power at that point does not stop the leak. The pump must be completely out of power before the memory leak stops.
  • Tank
    • No memory leak occurs when initially placed in the world. Once fluid is added to the tank the memory leak begins. You can stop the memory leak by removing the fluid from the tank (used a bucket to test).
  • Fluid Infuser
    • No memory leak occurs when initially placed in the world. Once fluid is added to the machine the memory leak begins. You can stop the memory leak by removing the fluid from the machine (used a bucket to test).

Steps to Reproduce:

For all objects I watched the task manager before, after, and during each action to observe the memory usage of the java instance. In each case the memory usage climbed up steadily and predictably at the cadence of minecraft ticks, and stabilized immediately afterwards.

  • Pump
    • Set the pump up above an infinite water source (I used a 2x2 area of water) and connect it to power (you don't need pipes or tanks, just the pump with power). The memory leak will be steady and consistent. Next disconnect the pump from power and place a tank at the output valve. Empty the tank using buckets until the pump is completely out of power, then destroy or pick up the tank. The memory leak will cease.
  • Tank
    • Place a tank on the ground and using a bucket add water to the tank. The memory leak will be steady and consistent. Next use buckets to remove all fluid from the tank. The memory leak will cease.
  • Fluid Infuser
    • Place the Fluid Infuser on the ground and using a bucket add water to it. The memory leak will be steady and consistent. Next use buckets to remove all fluid from the Fluid Infuser. The memory leak will cease.

Technical Information:

  • Minecraft: 1.17.1
  • Fabric API: 0.37.0+1.17
  • Industrial Revolution: 1.10.0-alpha.10
  • Modpack: All of Fabric 4 - 0.0.7

Logs:
n/a

Details:
Win10
GeForce 1660 Ti

commented

I was wondering why I was crashing when I stayed next to my fluid infuser for too long. I've been having this problem too, I'm using 1.10.0-alpha.12

commented

MC 1.17.1
Fabric API 0.37.2
IndRev 1.10.0-alpha.12

Can reproduce all 3. I was wondering why my FPS would start going from mostly 100+ all the way down to 1 when I was hanging around my indrev factory.

While following your steps, I observed steady 2-10mb per ~second increase in RAM usage. Destroying blocks that have fluids in them or emptying it, simply stops the increase, but does not lower the RAM usage back to normal.

The bug is also reproducible with a heat generator:

  1. Place down a heat generator
  2. Use a lava bucket on it
  3. Watch the RAM usage rise

Safe to assume everything that interacts with any kind of fluid is affected.

Before that, I noticed that the pump never stops using energy, even if it doesn't output the fluid to anywhere. I couldn't figure out the exact conditions, so didn't report it and just used creative containers to power my pumps for now. I'm 99% sure that did not happen on 1.17 (so pre alpha8). Perhaps this behaviour has something to do with the memory leak. You can partially reproduce this by doing the following:

  1. Place down a Lazuli flux container mk1 or mk3 for convenience
  2. Connect it to a pump that is placed above a water source
  3. As soon as the pump connects, it will empty mk1 container despite needing much less energy; mk3 will lose about 15k energy
  4. Now disconnect the pump from the Lazuli flux container
  5. Connect it again
  6. The mk1 variant will get emptied again; mk3 will lose about 15k energy again

You can repeat the 4-6 steps to empty ANY Lazuli flux container entirely, despite the pump not needing any of that energy, since it's idling. Fairly sure on every server restart the energy drain happens the same way, as if you manually disconnected and reconnected the blocks. Which means if you have multiple pumps and restart even once, you risk losing a lot of energy for nothing.

commented

I've looked into this issue for the past few days and I still cannot find the cause to the memory leak. IR uses LBA's rendering helper which I thought was at fault at first, but other mods using it don't seem to have the same issue. Any machine, including GUIs, that have fluid rendering seem to be affected.

tl;dr I didn't find the problem yet, just giving an update. Any help is welcome.

Before that, I noticed that the pump never stops using energy, even if it doesn't output the fluid to anywhere. I couldn't figure out the exact conditions, so didn't report it and just used creative containers to power my pumps for now. I'm 99% sure that did not happen on 1.17 (so pre alpha8). Perhaps this behaviour has something to do with the memory leak. You can partially reproduce this by doing the following:

This is unlikely related and I cannot reproduce it, please test with the latest version and open a separate report if it still happens.

commented

Er this wasn't meant to be closed automatically :p (Sadly github didn't see the "maybe" before the "fix" :/ )

commented

I'll release a fixed version soon(ish). I reopened in case someone else has the same issue

commented

We have been running into memory leaks with our server also. Though I can't 100% guarantee that this is the cause for our issues, but it's one of the few mods that have 'active' changes to game behaviour. Hope you can figure out the issues soon!

commented

This has been fixed for a bit, you can download the latest versions on CurseForge. Thanks for reporting!