TerraFirmaGreg-Team / Modpack-Modern

An innovative modpack that contains GregTech and TerraFirmaCraft on 1.20.x.
GNU General Public License v3.0
61 stars 14 forks source link

Server crash due to mass GC request #466

Open Supermarcel10 opened 1 month ago

Supermarcel10 commented 1 month ago

Version modpack Used

1.20.x-0.7.12

Environment

Multiplayer

Side Crashed

Server

New Worlds

Yes

Steps to Reproduce

There does not seem to be any clear steps to reproduce this issue.

Some things can be ruled out based on the different states of the server.

General things spotted:

Java arguments that were tried on the server: 1) java -Xms128M -Xmx8192M -Dterminal.jline=false -Dterminal.ansi=true $( [[ ! -f unix_args.txt ]] && printf %s "-jar minecraft_server.jar" || printf %s "@unix_args.txt" ) 2) java -Xms128M -XX:MaxRAMPercentage=95.0 -Dterminal.jline=false -Dterminal.ansi=true $( [[ ! -f unix_args.txt ]] && printf %s "-jar minecraft_server.jar" || printf %s "@unix_args.txt" )

Crash Report

crash-2024-09-07_00.37.58-server.txt debug-5.log

Additional Information

This is likely caused by a broken mod as part of the server modpack.

The container itself does not show any signs of nearing the allocated memory, but the CPU is showing significant red flags.

Server in a "semi-normal" state: image

This would imply to me that GC is being called almost every 2 seconds or so, causing the server to kill itself by constantly calling GC for a non-existent problem with memory.

Server in a crashed state: Screenshot_8

Supermarcel10 commented 1 month ago

Taking a look further at this, it seems the server never exceeds 3076 MiB, even under synthetic workloads. Under synthetic workloads, the server then crashes in about 240 seconds of starting with the exception OutOfMemoryError: Out of heap space.

Supermarcel10 commented 1 month ago

Information

I've found a solution to this issue. It seems the modpack uses an arbitrary launcher, which does not pass through the allocated memory to the server JVM.

I will leave this issue open, since it seems inherently unknown why the modpack abstracts the server behind a launcher for no apparent reason.

Notes

Solution

In my container I copied over the run configuration $CONTAINER/libraries/net/minecraftforge/forge/1.20.1-47.3.0/unix_args.txt to $CONTAINER/unix_args.txt. Your version may vary if you have not updated forge, but same results should apply.

You can clean up any jar files in the root of the container, including deleting minecraft_server.jar. Prior to executing the java command change the parameters to printf %s "@unix_args.txt". You should then be able to launch the container like normal. It should start up a lot faster, because it's no longer executing via a separate launcher.

My exact jvm arguments are as follows:

java -Xms128M -XX:MaxRAMPercentage=98.0 -Dterminal.jline=false -Dterminal.ansi=true $( [[ ! -f unix_args.txt ]] && printf %s "-jar minecraft_server.jar" || printf %s "@unix_args.txt" )

These arguments provide me with the best flexibility working with execution via unix_arg injection and via direct jar execution on different container hardware configurations.