Django, uWSGI & nginx: Process dies for “no reason

2019-05-31 07:15发布

I am using uWSGI and nginx to run two parallell Django apps. One of them, the one with somewhat more load (both are very small) keeps dying about once every 24 hours with the following message:

[pid: 16358|app: 0|req: 1000/1000] 127.0.0.1 () {46 vars in 847 bytes} [Thu Mar 24 16:38:31 2011] GET /aktivitet/409/picknick/ => generated 18404 bytes in 117 msecs (HTTP/1.0 200) 3 headers in 156 bytes (1 switches on core 0) ...The work of process 16358 is done. Seeya!

I am launching the processess using Supervisor with the following config:

[program:uttrakad] command=/home/myuser/webapps/uwsgi_test/bin/uwsgi -s /home/myuser/webapps/uwsgi_test/app1.sock -C /home/myuser/webapps/django/app1.wsgi --processes 1 --harakiri 120 --max-requests 1000 autostart=true autorestart=true stdout_logfile=/home/myuser/logs/user/uwsgi_app1.log redirect_stderr=true stopsignal=QUIT

The .wsgi file is simple:

import os import sys sys.path =['/home/openworks/webapps/django/lib/python2.6/','/home/openworks/webapps/django/','/home/openworks/webapps/django/app1/'] + sys.path from django.core.handlers.wsgi import WSGIHandler os.environ['DJANGO_SETTINGS_MODULE'] = 'app1.prod_settings' application = WSGIHandler()

nginx is set up with 2 worker processes, 2048 worker_connections and like this: location / { uwsgi_pass unix:///home/openworks/webapps/uwsgi_test/app1.sock; include uwsgi_params; }

As I said, there is one more app configured the exact same way that has been running without interuption, but is almost has no traffic.

Any clues? Why do I get the "...The work of process 16358 is done. Seeya" messsage?

Thanks

2条回答
混吃等死
2楼-- · 2019-05-31 08:00

Seems like it. We use monit to monitor and restart websites, databases, tunnels etc.

查看更多
ら.Afraid
3楼-- · 2019-05-31 08:01

Look at the log: req: 1000/1000

And you have set 1000 as the number of maxium requests.

You should always add --master/-M on uwsgi even under supervisord, this will allow to restart apps without losing the socket (and without spitting out an error to clients during restart).

查看更多
登录 后发表回答