Railcraft

Railcraft

34M Downloads

Possible Resource Leak: Iron Tanks

pyure opened this issue ยท 10 comments

commented

Description of the Bug
Iron and Steel tanks may be leaking memory instead of liquids.

To Reproduce
Use an infinite fluid generator from whichever mod.
Pipe fluid into tank. Wait 90-180 minutes. Lag spikes will ensue.

Negative Test
Replace the RC tanks with tanks from another mod. No lag.

Expected behavior
No lag

Additional context

  • railcraft-12.0.0.jar
  • forge-14.23.5.2835
  • infitech 3 modpack (infitechs gotta have RC by tradition. duh.)
  • We spent several days trying to narrow down and isolate this to a specific mod before wasting anyone's time; that said, our evidence is only empirical. The common factor we've observed is Railcraft multiblock tanks, but it could also be that the various mods we've used for piping (Thermal Dynamics, Gregtech CE) are having difficulties working with the tanks for reasons specific to those mods.
commented

Duplicate of #2015

commented

@pyure Run on a dedicated server environment and get a garbage collector or java core dump. Your suspicion here is not enough without a dump like that in pyure/infitech-prototype#447 (comment)

commented

Understood, will do as advised.

commented

You can do it both on a client and a dedicated server so that the developers can better spot the cause (i.e. whether this is host logic or render related)

commented

I've recreated the issue with a minimal example, using a railcraft iron tank and a water generator (from nuclear craft in this example, but it should be swappable with any other generator).

You can download the GC heap dump I've collected here : (https://drive.google.com/open?id=1NEKjUJH7c4AAUnZleYjagCXDfc6UhJLx)
Both client and dedicated server dumps are included.

As an important note, when I disabled foamfix with this setup, I did not encounter the memory issue.
It only seems to happen with both foamfix (version 0.10.5-1.12.2) and the RC iron tank.

commented

liach, in your opinion is this something more properly suited to annoying asie about? If its a combination of the two mods causing the issue, it could just as easily be the other mod.

commented

Archengius from GT-CE made these comments, I'm tracking them here:

@liach i'm 99% sure that RC tanks + foamfix memory leak is caused by RC's mods.railcraft.client.render.models.resource.FluidModelRenderer
baking model newly created fluid model each frame, manually creating extended block state for it, baking quads with it
it has chances to have huge issues with optimizations foamfix performs
and in fact memory footprint is going to grow each draw frame
proportionally to amount of frames per tick
that also explains why @Georggi memory-leaked much faster than me with his 200+ FPS and mine limited to 60
my suggestions are:
a) cache baked models and their blockstates instead of creating them each frame
b) switch fluid renderer implementation to simple manual rendering of 6 quads - that would also resolve issues with ugly scaling of fluid texture in tanks

commented

liach have you put any thought into this? Its the number one negative issue with our users by far right now :( :(

commented

Given cj is away now, I think the best bet is to write a coremod that fixes this issue. Let me take some time out for this

commented

Understood, won't pester you further. Thanks kindly sir.