Question

I use a supervisor to run uWSGI application. Why uWSGI application does not always stop after stop supervisor? supervisor config:

[program:test]
autostart = true
user=root
command=uwsgi --master --workers  5 --disable-logging --socket 127.0.0.1:8888
--module web --callable app
priority=1
redirect_stderr=true
stdout_logfile = /data/log
Was it helpful?

Solution

By default supervisor send SIGTERM on stop. SIGTERM in uWSGI means 'brutal reload'.

You have to change it to QUIT or INT:

stopsignal=QUIT

should be enough

Another approach (discouraged) is adding --die-on-term to uWSGI command line to change its default behaviour

OTHER TIPS

  1. project supervisor config file

    add stopsignal=INT

  2. project uwsgi config file

    remove daemonize=xxx.log to disable daemon mode

If you use "processes = #" into your uwsgi configuration, you also must use "master = true". If not, supervisor only will kill one of workers.

Then:

/etc/supervisor/conf.d/app.conf

stopsignal = QUIT

/etc/uwsgi/app.ini

processes = 4
master = true

If you are running your UWSGI with master and workers you need to add in your /etc/supervisor/conf.d/app.conf file

stopasgroup=false
killasgroup=false

or else no matter what stopping uwsgi will spawn more master and so is workers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top