1

enter image description here

Above table's second column is pid.

I'm using upstart for daemonize uwsgi, and upstart configuration file is here:

respawn

chdir ${DIR_OF_PROJECT}

script
    set -a
    . ${DIR_OF_PROJECT}/.env
    uwsgi --ini uwsgi.ini --plugin python3 --master --die-on-term
end script

uwsgi is started by last line of script section.

When uwsgi is dead, uwsgi is respawned by respawn option.

But problem is worker processes not exited when uwsgi process is dead.

For example, if I run sudo kill -9 5419, 5421, 5433, 5434, 5435, 5436 process not exited. (It's example is process 5373, 5391, 5392, 5393, 5394.)

So this situation is repeated whenever uwsgi is dead, then server is down cause insufficient memory.

What's the problem?

JuHong Jung
  • 226
  • 5
  • 19

1 Answers1

1

Have you tried specifying the die-on-term parameter in uwsgi.ini like this:

[uwsgi]
module = wsgi:application

master = true
processes = 5

socket = myapp.sock
chmod-socket = 664
vacuum = true

die-on-term = true

This works for me in my projects.

You can also check out a step by step tutorial here: https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-ubuntu-14-04

shish023
  • 533
  • 3
  • 10