Python script gets killed

Posted September 21, 2016 44.9k views

I am a newbie to digitalocean.

I have just created the smallest VPS and then install python, pip and all required python modules in order to move my scripts which work fine on local server.

Right now, my script starts without any problem but suddenly gets killed. How can I understand the reason and solve this problem?

Do you have any idea under which circumstances digitalocean VPS kills any running script?

1 comment
  • I would check syslog to verify you’re not running out of memory.

    There are no circumstances in which DigitalOcean will kill a script on your machine. It’s all handled inside your virtual machine.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

If this is smallest Droplet it could that script run out of memory.
You should check syslog for Out Of Memory killer.
syslog is located at /var/log/syslog and you can opet it with your favourite text editor:

  • nano /var/log/syslog

Here you can try to find Out of Memory (OOM) killer signal. If there are for your script, it means you ran out of memory.
If you need help with logs, post part of it here, but make sure you redact sensitive informations if they are any.

  • You’re right.. It is the smallest Droplet and after checking the syslog, I have seen the Out of memory logs and killed process details..

    • I can recommend you two things:
      First option is to upgrade to bigger Droplet.
      Second option would be to add Swap. In this case you don’t need to upgrade your Droplet.

      How to add swap on Ubuntu 16.04 tutorial should help you install Swap if you want

      by Justin Ellingwood
      One of the easiest way of increasing the responsiveness of your server and guarding against out of memory errors in your applications is to add some swap space. In this guide, we will cover how to add a swap file to an Ubuntu 16.04 server. <$>[warning] [label...