Minecraft Server Memory Issues on Linux

Are you having memory leak issues with your Minecraft Server on Linux? The solution might be in this post. I’ve been running a MC server on my VPS (HeartInternet) for the last 4 months. It was all good until we started exploring the map. The MC server was randomly being killed and this message was coming up in our screen:

Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host

For some time I just restarted the MC server and continued playing. Then it became very frequent and forced me to investigate it. I monitored all the logs and I saw this in /var/log/messages:

Out of Memory: Killed process 31103 (java)

That time I only had 1 GB memory + 1 GB swap. I increased the swap to 3 GB but nothing changed. It was still able to exhaust the memory. I tried changing -Xms and Xmx arguments, didn’t help.

Somewhere I read OpenJDK 1.6 might cause problems running MC server. I checked my OpenJDK version and indeed it was 1.6.

You can check version of java using this command:

java -version

On CentOS I was able to upgrade OpenJDK using yum:

yum remove java-1.6.0-openjdk
yum install java-1.7.0-openjdk

It has been more than a week. The MC server hasn’t had any memory issues.

Leave a Reply

Your email address will not be published. Required fields are marked *