java.lang.OutOfMemoryError: Metaspace

Discussion in 'Systems Administration' started by NickMD, Aug 14, 2019.

  1. My server keeps on crashing because it "runs" out of memory so i went ahead and got more RAM and now have 8GB of RAM.

    It's been crashing for weeks now and i have to do a force stop and start the server every day, 2-3 times a day.

    Im not sure what is wrong with the server, i did not change anything and this would never happen, now randomly this happens even though there are the same amount of players/same plugins/same world same host same everything.

    There is no corrupted chunks in any of the worlds.

    Here is the timings report:
    https://timings.aikar.co/?id=6da41677afe34850a9a91dc3bf2f04e0

    Here is the latest.log
    https://filebin.ca/4rWHBcCnZofk/latest.log
    Here is also another log before the latest:
    https://pastebin.com/9JBYsC4H

    Using PaperSpigot 1.8.8-R0.1-SNAPSHOT

    Let me know theres anything else i can provide to find the solution
     
  2. Remove this from your startup flags "XX:MaxMetaspaceSize=128M". That is what limits your meta space even though you increased the RAM (read heap) to 8 GB.
     
  3. How do i change that, Where is it located?
     
  4. Same place as where you increased RAM to 8 GB.
     
  5. My server is ran by a host, i had to purchase 2 extra more GB. I cannot change the amount of RAM/CPU u have
     
  6. Oh, in that case ask your host. Hosts usually do not allow you do edit these JVM flags.
     
  7. What do you think the max size should be set it for a server that has 20-40 ppl on daily?
     
  8. Wait i think i know what you talking about, are you talking about the network-compression-threshold in the server.properties file?
     
  9. No.

    So normally when you host a server yourself you have an executable that runs something like "java-Xmx4G -Xms4G -XX:MaxMetaspaceSize=128M -jar spigot.jar". In your case the flag "-XX:MaxMetaspaceSize=128M" is limiting the maximum size of the metaspace. The server logs you provided contain "[06:50:00] [Thread-43/WARN]: java.lang.OutOfMemoryError: Metaspace", meaning that the metaspace is too small. So we must either increase the metaspace size or remove the limit completely.

    Like you mentioned, you are with a hosting provider. As you don't have access to change the java command and flags, you must ask your host to do this. They should know how to solve this when you mention that they must remove or increase "-XX:MaxMetaspaceSize=128M" in the java flags. If they don't, then it's time to move to a new host.