Server is crashing when connected for more than a few minutes

I’m not sure if this is the correct category.

I’m having a problem where when someone connects to the server, I get a few warnings about the server not being able to keep up and skipping ticks in the log and then the server crashes, unless I disconnect before that happens, then the server just keeps running and the warnings stop. I’ll copy part of the log here:

[12:40:28] [Server thread/INFO]: PcNerd512[/] logged in with entity id 270 at (189.5, 65.20283987024771, 265.5)
[12:40:29] [Server thread/INFO]: PcNerd512 joined the game
[12:40:33] [Server thread/WARN]: Can’t keep up! Did the system time change, or is the server overloaded? Running 3150ms behind, skipping 63 tick(s)
[12:41:36] [Server thread/WARN]: Can’t keep up! Did the system time change, or is the server overloaded? Running 44292ms behind, skipping 885 tick(s)
[12:41:43] [Server thread/WARN]: Can’t keep up! Did the system time change, or is the server overloaded? Running 6410ms behind, skipping 128 tick(s)
[12:42:46] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.StringCoding$StringEncoder.encode( ~[?:1.8.0_111]
at java.lang.StringCoding.encode( ~[?:1.8.0_111]
at java.lang.String.getBytes( ~[?:1.8.0_111]
at Method) ~[?:1.8.0_111]
at ~[?:1.8.0_111]
at ~[?:1.8.0_111]
at bez.c(SourceFile:77) ~inecraft_server.1.12.jar:?]
at ams.P(SourceFile:2647) ~inecraft_server.1.12.jar:?]
at ayc.a(SourceFile:109) ~inecraft_server.1.12.jar:?]
at ol.c(SourceFile:147) ~inecraft_server.1.12.jar:?]
at ol.a(SourceFile:166) ~inecraft_server.1.12.jar:?]
at om.a(SourceFile:881) ~inecraft_server.1.12.jar:?]
at net.minecraft.server.MinecraftServer.a(SourceFile:378) ~inecraft_server.1.12.jar:?]
at net.minecraft.server.MinecraftServer.C(SourceFile:578) ~inecraft_server.1.12.jar:?]
at inecraft_server.1.12.jar:?]
at [?:1.8.0_111]
[12:42:47] [Server thread/ERROR]: Could not save crash report to ./crash-reports/crash-2017-07-10_12.42.47-server.txt
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.nio.HeapByteBuffer.( ~[?:1.8.0_111]
at java.nio.ByteBuffer.allocate( ~[?:1.8.0_111]
at sun.nio.cs.StreamEncoder.( ~[?:1.8.0_111]
at sun.nio.cs.StreamEncoder.( ~[?:1.8.0_111]
at sun.nio.cs.StreamEncoder.forOutputStreamWriter( ~[?:1.8.0_111]
at ~[?:1.8.0_111]
at b.a(SourceFile:230) inecraft_server.1.12.jar:?]
at inecraft_server.1.12.jar:?]
at [?:1.8.0_111]
[12:42:47] [Server thread/ERROR]: We were unable to save this crash report to disk.
[12:42:47] [Server thread/INFO]: Stopping server
[12:42:47] [Server thread/INFO]: Saving players
[12:42:47] [Server thread/INFO]: Saving worlds
[12:42:47] [Server thread/INFO]: Saving chunks for level ‘world’/overworld
[12:42:48] [Server thread/ERROR]: Exception stopping the server

It looks like it’s running out of memory, but I think (I set -Xmx and -Xms to 2048MB) I gave the server 2GB, which should be enough for 1 player. I’m kind of out of ideas myself, I searched Google and this forum for this issue, but I found nothing where the server actually crashed.

Also, less important at the moment but still an issue: I can’t find the server console where I can whitelist or OP players.

Any help is appreciated!

EDIT: The crashes seem to have solved themselves now, but I’m still getting the warnings about the server not being able to keep up.

hi WiFiCable,

yes, i would say trying 3gb is what is required on Xmx and you may also want to Xms to 256 or 512mb should help some…

good luck!


Ok, I set -Xms to 512MB and -Xmx to 4096 MB, but can you please explain what Xmx and Xms actually are?

hi WiFiCable,

my understanding is they are the min and max java heap allocation size (memory allocated).

ms is min and mx is max.

when i had similar to your error allocating a little more cleared it up.

good luck!


Ok, thanks! At the moment the warnings have stopped, so I think it worked.

fantastic news! cheers!

fogot to mention the warnings about server cant keep up are common and no big deal unless the numbers get really big. skipping 128 tick(s) is fine skipping 12800 tick(s), not so much.


Ok, thanks for telling me that. Also, just because I’m here right now, do you know any way to protect a certain area in a world, for example the spawn?

i’m not sure what you mean by protect, exactly?

I mean that players can’t build or destroy blocks there.

on a multi player game i believe this is called “griefing” where some players destry what other users have created.

i think there may be a way but i do not know it.

Ok, doesn’t matter. Thanks a lot for your help!

That was your error which @tNt helped you fix, and as for spawn protection, you may either use plugins such as WorldGuard, Factions, etc or you may open up your file, look for the line that says “spawn-protection=” which is likely set to 16 blocks, giving you a 16-block protection in all directions from the center spawn block, and change that to whatever number you want it to be (remember it’ll be out from that center spawn block to whatever number of blocks you choose in all directions, and you may want/need to relocate the spawn area if you built spawn elsewhere.

The weird thing is that the server was not at all using the 2GB I had set at the time (now 4GB), and it was still reporting being out of memory.

I later found out when my friends joined that only people with OP can edit the spawn area, which was indeed already set to 16 by default.

Note, this isn’t an OutOfMemory error as in yoru heap–this refers to the Garbage Collection part of Java.

Are you using any Java GC parameters? What sort of server are you running?

You mean the garbage collection ran out of memory? Also, at the time I was running a vanilla server, but now it’s a Spigot server.

Take a look at this Stackoverflow answer:

Note in the comments, it is specifically mentioned that upping the Heap (e.g., Xmx) isn’t directly addressing the problem–it lies somewhere else. The unfortunate part is that if you’re using vanilla, there’s really not much I can think of that should be able to address inefficient garbage collection.

If Minecraft were memory leaking, there’s not much you can do other than 1) restarting the host or 2) running an integrity check on your world for corruption (maybe?).

Switching to another server software is a good step–possibly even the best step–because it means whatever could have been causing the issue before might have been tied to some code that simply doesn’t exist in Spigot.