0

I have a Minecraft server (1.16.4) and having trouble with RAM usage causing my server to suddenly stop working. I have 8GB RAM and my server runs on Linux and when I start the server, my ram is 3GB, but when someone joins (around 3-5 players) the RAM usage increases until it reaches 8GB ram, and after it reaches 8GB my server suddenly stopped working and I can't stop or restart the server because my console also freezes.

Before it reach 8GB ram, the server was at 20 TPS but after ram reach 8GB, my server suddenly dropped its TPS, but I don't know it because of my plugins or memory leaking.

  • with 3 to 5 player my ram is (3GB/8GB)
  • after playing for 1 hour my ram hit 8GB ram (7.89GB/8GB)

my server Startup Settings:

java -Xms8000M -Xmx8000M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs/ -Daikars.new.flags=true -jar server.jar nogui

this server is running on Pterodactyl Panel.

Plugins (62):

AdvancedEnchantments, AdvancedRegionMarket, AltDetector, AnimatedScoreboard, AutomaticBroadcast, AutoPluginLoader, BungeeTabListPlus, Citizens, ClearLag, ClearLagTimer*, ColoredSigns*, CommandPanels, CoreProtect, DeluxeMentions, DiscordSRV, Essentials, EssentialsAntiBuild, EssentialsChat, EssentialsGeoIP, EssentialsProtect, EssentialsSpawn, FastChunkPregenerator, FogusCore, GoldenCrates, GoldenEnchants, GSit, Harbor, HolographicDisplays, ImageMaps, Jobs, LuckPerms, LWC, mcMMO, Minepacks, MMOItems, MMOLib, Multiverse-Core, NexEngine, OpenInv, PlaceholderAPI, PlayTime*, Playtimes*, ProtocolLib, QuantumShop, Quests, RandomTeleport, SilkSpawners, Towny, TownyChat, TownyNameUpdater, UltimateAutoRestart, UnlimitedEnchants, Vault, ViaBackwards, ViaRewind, ViaVersion, Votifier, VotingPlugin, WorldEdit, WorldGuard, WorldGuard-Towny*, WorldGuardExtraFlags

What's causing my server to do this?

9
  • try disabling all/some of your plugins and see if the issue persists. it could be a plugin hogging memory
    – Topcode
    Jan 3 at 4:58
  • if you have 8gb ram you should not give all of it to the server
    – qwr
    Jan 3 at 5:50
  • @qwr i already do that.. but still no effect.
    – HxZ
    Jan 3 at 11:26
  • @Topcode i already do that... I make the server 0 plugins and adding the plugins one by one.
    – HxZ
    Jan 3 at 11:27
  • 2
    @HxZ To confirm, the problem still occurs when the -Xms and -Xmx flags are set to 5000M, or lower values? As soon as it reaches maximum memory, it freezes?
    – Corsaka
    Mar 26 at 9:23
1

First, some questions:

  1. Do you have a 'swapfile' configured?

If you don't, your OS might become unresponsive. In Linux, especially the less 'userfriendly' distros, you may have to configure this manually. It's recommended to have swap equal to twice your memory (in your case, 16GB). Your OS will decide which chunks of memory are 'stale' and can be swapped out to disk on the fly.

The swap file serves as a slower cache for memory that's accessed less often. For well-behaved programs, it can work quite well, especially if you have a faster disk (like, say, an SSD), although SSD's can wear out if they have to swap constantly (that is, if you're running heavy memory things 24/7).

  1. As in the comments, have you tried limiting minecraft to less memory, so you have some spare for your kernel, systemd, console, etc? (Say, 7G)

Most games are not well-behaved in this sense though. Because of their real-time requirements, and because interfacing with kernels is harder than DIY, developers often create their own internal rudimentary memory managers and request very large contiguous sections of memory from the OS.

Which means the OS is blind and doesn't know what to swap, so it either swaps everything or gives up.

If you still keep running into issues with running out of memory, try to check whether your server actually respects the command line you give it. If it won't, you might want to tell your OS to limit minecraft's memory usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.