Minecraft servers on dedicated servers crashing with "java.lang.OutOfMemoryError: unable to..."

Discussion in 'Systems Administration' started by d1m0a1n, May 21, 2016.

  1. My Bungee proxy and main server have crashed multiple times with this error
    Code (Text):
    [01:43:16] [Server thread/ERROR]: Encountered an unexpected exception
    java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method) ~[?:1.8.0_77]
        at java.lang.Thread.start(Thread.java:714) ~[?:1.8.0_77]
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950) ~[?:1.8.0_77]
        at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1368) ~[?:1.8.0_77]
        at org.bukkit.craftbukkit.v1_9_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:364) ~[spigot-1.9.jar:git-Spigot-e000104-4cb3258]
        at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:729) ~[spigot-1.9.jar:git-Spigot-e000104-4cb3258]
        at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) ~[spigot-1.9.jar:git-Spigot-e000104-4cb3258]
        at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) ~[spigot-1.9.jar:git-Spigot-e000104-4cb3258]
        at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [spigot-1.9.jar:git-Spigot-e000104-4cb3258]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]
    [01:44:55] [Spigot Watchdog Thread/ERROR]: The server has stopped responding!
    I see it's out of memory, but there should be enough RAM. The main server has 14GB allocated and rarely uses over 10. The Bungee proxy has 1500MB, which is more than enough. My dedicated server has 32GB of ram and HTOP only showed ~20GB being used when the server crashes. I've noticed that over the past couple days, after setting up automatic restarts, it's only crashed after being online for about 11 hours. It's usually the main server crashing, the proxy has only crashed with this error one or two times.
  2. See here. Its not an issue of memory, its an issue of threads.