Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a minecraft server running in a VPS and sometimes my server is being killed unexpectedly.

I don't believe this is a java error because no error is thrown and this happens when the server is running nicely, also I see a message from my script that calls the java command saying that the process has been killed and also tells me the process id and the line in the sh script that was killed:

My script:

#!/bin/sh
cd /home/minecraft/server
FILE=mcpc-plus-legacy-1.4.7-R1.1-SNAPSHOT-f534-L31.jar
#LOG="log`date +'%Y-%m-%d.%H:%M:%S'`.log"
while :
do
LOG="log`date +'%Y-%m-%d.%H:%M:%S'`.log"
echo "Iniciando..." >> "$LOG"
rm log-latest.log
ln -s "$LOG" log-latest.log
java -Xmx7680M -Xms4096M -XX:MaxPermSize=192M  -jar "$FILE" 2>> "$LOG"
#-Dcom.sun.management.jmxremote \
#-Dcom.sun.management.jmxremote.port=9010 \
#-Dcom.sun.management.jmxremote.local.only=false \
#-Dcom.sun.management.jmxremote.authenticate=false \
#-Dcom.sun.management.jmxremote.ssl=false \
# -jar "$FILE" >> "$LOG.std.txt"  2>> "$LOG"

echo "Aperte CTRL + C para cancelar"
sleep 5

done

The message that is displayed when the process is killed:

/home/minecraft/server/acao_iniciar.sh: line 22: 23546 Killed java -Xmx7680M -Xms4096M -XX:MaxPermSize=192M -jar "$FILE" 2>> "$LOG"

There's no cronjob configured and the last command doesn't show any strange connection through SSH.

share|improve this question
3  
Are you running out of memory on the server? It might be killed by the OOM killer. –  terdon Jun 11 '13 at 20:28
    
@terdon that's actually a possibility, the VPS has 8GB of RAM and is also running MySQL and some small services related to plesk, I didn't knew that other processes could be killed that way –  José Roberto Araújo Júnior Jun 11 '13 at 20:40
    
@terdon I've lowered Xmx to 7168M , same has 7GB and I'm testing now –  José Roberto Araújo Júnior Jun 11 '13 at 20:41
    
@terdon after that I never had this problem anymore, why don't you answer the question so I can choose your answer has best answer? –  José Roberto Araújo Júnior Aug 22 '13 at 3:38

1 Answer 1

up vote 1 down vote accepted

One likely reason is that your server is running out of memory and the process is being killed by the OOM killer. This is a mechanism in Linux that will kill low priority processes when the system is running out of memory.

If this is the case, you should be able to fix it by i) reducing the amount of memory you allow your java process to take, ii) increasing the process' priority (nice -15) or iii) increasing your available memory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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