AllTheMods / ATM-8

All the Mods 8
136 stars 32 forks source link

RAM usage too high server freezing. #671

Open husky2331 opened 1 year ago

husky2331 commented 1 year ago

Hey, I have a server on a VPS. RAM usage looks abnormally high even without players (idk how it is for modded minecraft, maybe 4-6 gigs is fine). When there are like 4 people the RAM fills up and the server sometimes freezes and has to be force closed.

It's running on the Pterodactyl panel and has 10GB allocated using Aikar's flags. I've added some mods recently but the issue has occurred many times before.

GusMedeiros commented 1 year ago

I have the same problem, same panel. Would you run /spark profiler upload when It reaches close to Max memory and put the link here? Mine says there is 11k chunks loaded with nobody in the server and no chunkloaders. https://spark.lucko.me/fwdXThyFC8

ViRb3 commented 1 year ago

From https://docs.papermc.io/paper/aikars-flags:

DO NOT ALLOCATE ALL OF YOUR AVAILABLE MEMORY ON A SHARED HOST!

When setting the Xms and Xmx values, if your host says you have 8000M memory, DO NOT USE 8000M! Minecraft (and Java) needs additional memory on top of that Xmx parameter. It is recommended to reduce your Xmx/Xms by about 1000-1500M to avoid running out of memory or "OOMKiller" hitting your server. This also leaves room for the Operating System to use memory too. Have 8000M memory? Use 6500M for safety. But you may also ask your host if they will cover this overhead for you and give you 9500M instead. Some hosts will! Just ask.

Are you maybe allocating too much RAM? Make sure you allocate less than what your host allows. Check my more in-depth explanation at https://github.com/AllTheMods/ATM-8/issues/704.

husky2331 commented 1 year ago

Since posting the issue I have uninstalled pterodactyl and I'm running the server without a panel. The crashes have reduced and the freezes have stopped but the ram usage is still way too high for some reason. On ptero I had allocated like 10GB of ram out of 12, and I couldn't even find an oom killer option anywhere so I don't think that might have been the problem. I have allocated some swap for the server so that might have helped reduce the crashes as well. Right now I'm seeing 11GB of ram and 3GB of swap used which I find really weird. I think it could be either caused by a memory leak (unlikely because I have not seen any other people on ATM complaining about a memory leak) or there is something wrong with the world because it's the same world that we used before updating the modpack.

Just in case someone might be able to get any useful information out of it, here is the spark profiler: https://spark.lucko.me/MP7Q7p6Be0

ViRb3 commented 1 year ago

A CPU profile won't help with diagnosing memory leaks. You need to create a memory (heap) dump, but note that it will be as large as your RAM.

Although, from your Spark profile, your server is realistically using only 6GB RAM, which I don't find strange?

husky2331 commented 1 year ago

The spark memory readout is most probably incorrect. When I turn the server off the ram completely frees up. htop shows that the whole server is using the full ram + some swap. I have tried looking through the heap dumps with some programs but I have no idea what to look for.