Memory Leak on long running server
fraenkelc opened this issue ยท 3 comments
Describe the Bug
My create above and beyond 1.3 server repeatedly came to a standstill (low tps etc) and spent most of the time garbage collecting. I took a heap dump and found millions of listeners, each taking up some bytes in a hashmap. In the screenshot below you can see 37 million com.simibubi.create.foundation.tileEntity.behaviour.inventory.CapManipulationBehaviourBase$$Lambda$20969 objects, all kept alive via World.loadedTileEntityList.
Looking at the code it might be due to the fact that the listener added in
Reproduction Steps
I'm not sure which of the many contraptions I had caused this.
Expected Result
I expect the mod not to have a memory leak.
Screenshots and Videos
Crash Report or Log
No response
Operating System
Linux server headless
Mod Version
0.3.2g
Minecraft Version
1.16.5
Forge Version
36.2.20
Other Mods
Modset of create above and beyond 1.3
Additional Context
No response
If its above and beyond related go to https://github.com/simibubi/Above-and-Beyond here
While I can't rule out that a cross mod interaction might be involved the 37 million instances of the onHandlerInvalidated listener are coming from the create mod.
I just came across this while looking for a different issue and realized I had the same issue a few days ago. Unfortunately I lost the link with the full heap stack but I do have screenshots.
create-1.18.2-0.5.0.i
The platform is a Forge server running version "40.1.92".
The detected Minecraft version is "1.18.2".
The server had a player count of 2 when the profile completed.
The system is running Linux (amd64) version "5.13.0-52-generic" and has 12 CPU threads available.
The CPU is described as an 12th Gen Intel(R) Core(TM) i5-12500.
The process is using Java 17.0.5 (unknown from Private Build).
The current process uptime is 206h 9m 39s.
Modpack: https://www.curseforge.com/minecraft/modpacks/uberswes-tech-pack/files/4469772
As you can see CapManipulationBehaviourBase was using 4GB here.
We believe it was related to this Stockpile Switch as the issue went away after we removed it.
We had an AE2 Storage bus which was placing items into the chest, the chest would then be emptied by the Smart Chute below and placed into the Portable Storage Interface below and then onto the train which is being loaded. We had 3 carriages with a 9x3x3 item vault on each being loaded. The AE2 storage bus would place these items into the chest several times per second. The server did eventually crash after having TPS spikes of 8000+ms