Starlight icon indicating copy to clipboard operation
Starlight copied to clipboard

Possible memory Leak?

Open PandaGGuy opened this issue 2 years ago • 5 comments

Hey there, Been trying to trackdown a memory leak on my server while pregening. I think i tracked it down to starlight?

My test server setup:

  • JDK: Zulu 17
  • Java Arguments: -Xms1024M -Xmx5G -XX:MaxMetaspaceSize=512M -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=compact -XX:ShenandoahUncommitDelay=20000 -XX:ShenandoahGarbageThreshold=10 -XX:ShenandoahAllocationThreshold=20 -XX:ShenandoahGuaranteedGCInterval=20000 -XX:ShenandoahUnloadClassesFrequency=60 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:+DisableExplicitGC -XX:+ParallelRefProcEnabled -XX:ParallelGCThreads=16 -XX:ConcGCThreads=4 -Dusing.aikars.flags=true
  • Base Mods:
    • fabric-api-0.46.4+1.18
    • lithium-fabric-mc1.18.1-0.7.7
    • sodium-fabric-mc1.18.1-0.4.0-alpha6+build.14
    • lazydfu-0.1.2
    • Chunky-1.2.164
    • spark-fabric

Test Procedure: Spun up two servers with same exact setup from above but one with starlight and one without. Ran chunky on both servers at the same time and took a heapdump after 10 minutes. Then let both servers sit idle for 5 minutes and took another heap dump. It looks like with starlight, java is struggling to clear out memory. This eventually causes the server to either hang/ crash due to out of memory/ or another occasional random crash while pregenning.

Example occasional crash while pregening w/ chunky on starlight server image

It looks like once pregening is done, the server is fine and memory is able to clear out but while pregening it keeps building which causes issues when Pregening large modded worlds.

Please find heapdumps in dropbox folder below: Speak Heap Dump Folder

Heads up, I do not have much dev experience in java. So if this was misidentified, please let me know!

PandaGGuy avatar Feb 13 '22 21:02 PandaGGuy

Can confirm I was having the same issue when generating with Chunky. After testing by uninstalling each mod one by one, the memory leak issues disappeared when I removed Starlight and restarted the pregeneration.

RadiantSol avatar Mar 23 '22 02:03 RadiantSol

I've run into the same thing, but only with chunky and not with other pregeneration mods. It's probably an issue on starlight's end.

ryleu avatar May 26 '22 15:05 ryleu

I can confirm Chunky with starlight 0.2 CPS without starlight 12 CPS. ETA for some chunk generation with starlight 400 hours without starlight 16 hours.

CrazyWolf13 avatar Jun 16 '22 09:06 CrazyWolf13

Interesting to see Starlight's SWMRNibbleArray[] appear as one of the larger heap users: image

I'm not even pre-generating large areas (I'm just flying around in the world!) and it is retaining 148MB of heap space.

Brittank88 avatar Jul 21 '22 04:07 Brittank88

Can confirm I am also having this issue

Funtimes909 avatar Jul 23 '22 02:07 Funtimes909