Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with forge server.. #10010

Closed
Chrysxv opened this issue Jun 16, 2024 · 5 comments
Closed

Memory leak with forge server.. #10010

Chrysxv opened this issue Jun 16, 2024 · 5 comments
Labels
Not Us The issue can't be fixed by us/isn't caused by us.

Comments

@Chrysxv
Copy link

Chrysxv commented Jun 16, 2024

Minecraft Version: 1.20.1

Forge Version: 47.2.0-47.3.1

Logs: I don't have any right now as i've reset everything multiple times.. Can easily get one if needed. Please test this to see what i'm talking about..

Steps to Reproduce:

  1. Download atm9 or any large forge modpack.. the more mods the quicker the issue will show. (happens with plain forge.. just takes alot longer without mods)
  2. Start the server.
  3. Start a pre-gen with forge pre-gen or any pre-gen mod.. (it happens without pre-gen.. but players need to explore.. just happens slower as the problem is chunk related..)
  4. With 16gb of ram issue usually occurs within 1-2hrs of running with pre-gen depending on how many mods are installed.

Description of issue:
After multiple weeks of testing thinking this was a memory leak with a mod.. it's not a specific mod.. its any mod. The more mods you add the worse it gets. Ram will slowly climb till it eventually uses all of it. Eventually leading to the server either crashing or becoming unplayable with 3tps or lower.. The lag is caused when ram hits max and G1 old generation clears.. Which clears less ram every time it goes off, eventually leading g1 old to clear nothing every 30-60 seconds but still causing a 10+ second lag spike every time.. tested with 3 different hosting companies, my personal pc and multiple well known modpacks. I know someone will say "dedicate more ram" but i don't have money to be purchasing more than 20gb.. Especially for a server that only gets around 5 people on at one time. From what i know 16gb should be more than enough. Please, if anyone can pinpoint an issue it would help a ton.. I've spent weeks 10+ hours a day trying to figure this out.

UPDATE: Tested with 20gb, 32gb, 100gb of ram (yes i know it's too much but i've tried literally everything and have no idea what to do now) and it all still crashes with an "out of memory" error after 1-2 hrs. This issue does NOT occur with vanilla minecraft.. I have talked to dozens of well known devs for them to be just as confused as I am. Again tested with multiple popular hosting companies such as bisect, bloomhost, apex, and again on my two personal computers. I have tried every version of java, every jvm arg, no jvm args, other garbage collectors, every mod that claims to fix memory issues or enhance performance, to run into the same exact issue. Nobody can explain what is going on here.

@Chrysxv Chrysxv added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jun 16, 2024
@PaintNinja
Copy link
Contributor

It sounds like you've got so-called "optimised" jvm flags such as those from Aikar's, which is a common culprit for GC-related issues. "Any large modpack" is too vague as well, we need proper steps to reproduce... What version of ATM9 exactly? Are we meant to keep pregenerating chunks until it OOMs or just leave the server idle or what?

@Chrysxv
Copy link
Author

Chrysxv commented Jun 16, 2024

Tested without flags.. and every flag i can find. Tested different garbage collectors aswell (Shenandoah GC, ZCG). It happens with any version of atm9 (i'm mainly testing with the newest version 0.2.60 but have tested with multiple others to experience the same issue). Any modpack with a good amount of mods. It doesnt matter what pack just depends on how many mods it has, the more mods the quicker the issue occurs. Keep pre-genning till it OOM's (which would happen in 1-2 hours with modpacks the size of atm9 using 16gb of ram) If you disable OOM it will keep showing pre-gen working.. but wont actually be generating chunks. No commands will register either.

@PaintNinja
Copy link
Contributor

Unable to reproduce with just Forge, so chances are the issue is caused by a mod. I tried two scenarios, both deliberately memory constrained to trigger the issue faster:

Scenario A:

  • Forge 47.3.1
  • All defaults, except -Xmx1G in the user_jvm_args.txt
  • Ran Forge's built-in chunk generation command with an insane amount of chunks (100,000) to keep the GC busy for a long time

It finished generating all the requested chunks successfully over the course of many hours and never crashed with an out of memory error.

Scenario B:

  • ATM9 server files 0.2.60
  • Deleted all args they added in user_jvm_args.txt
  • Added -Xmx3G
  • Ran the same chunk gen command

It took about an hour before it crashed with an out of memory error, despite having far less RAM allocated than you. The crash report lists some mods that might be involved in causing it, but I didn't look into it much as I was unable to reproduce the issue with just Forge alone.

Mentioning that you're throwing more RAM at it doesn't really change anything - excessive amounts of RAM allocated to the game will be wasted at best and cause increasingly extreme lag spikes at worst.


With this in mind, I'm going to mark this as "not us" and close the issue. Ask in the Discord or forums for help with troubleshooting, then file a new issue here when you're certain it's a problem with Forge itself (and not third-party mods made for Forge) and have a means for other people to reliably reproduce the problem. While we make a decent effort to help mod devs do things properly, ultimately we're not responsible for issues caused by mods - especially those that bypass Forge's APIs and directly modify the game.

@PaintNinja PaintNinja added Not Us The issue can't be fixed by us/isn't caused by us. and removed Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. labels Jun 17, 2024
@Chrysxv
Copy link
Author

Chrysxv commented Jun 17, 2024

It takes ALOT longer with vanilla forge as in 24+ hours before it even begins to show (with 16gb). When i said alot longer i meant alot longer.. I spent 3 very painful weeks testing with this i know its an issue with modding platforms in general as i can run pre-gen on a vanilla server for atleast a week no issues.. Ive spent 10+ hours a day binary testing mods and like i said before its NOT a specific mod.. but its ALL of them.. Each one you add it makes the issue happen faster. Also 3gb of ram for atm9 is not enough, recommended is atleast 8. Please run a test with vanilla forge for 24+ hours and maybe spark if you would like to watch the memory. IT WILL slowly climb. Even if it doesnt crash for awhile you will see it start to overload at some point because gc struggles.

@LexManos
Copy link
Member

There is no sane reason why you should be running a pre-gen command for 24+ hours. That would be trillions of chunks and run out of disc space if anything.
It is also recommended that you reboot your server after running a gen command because a lot of mods do weird things and it's best to just create your world, and load fresh.
We are not going to dedicate more time to what amounts to unsubstantial claims.
We've done out due diligence and attempted to reproduce your issue in a reasonable way.
At this point my only answer to you is that if you consistently get this every 24+ hours would be to schedule a time when you have few/no players and reboot the server.

@MinecraftForge MinecraftForge locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Not Us The issue can't be fixed by us/isn't caused by us.
Projects
None yet
Development

No branches or pull requests

3 participants