i am using a combination of uwsgi and nginx to serve my flask app. what happens is that after a few hours (under very low load, < several hundred requests) the requests time out until i restart the uwsgi process and things work again for the same amount of time.
here is the nginx conf:
server {
listen 3001;
server_name localhost;
charset utf-8;
client_max_body_size 75M;
location / { try_files $uri @myapp; }
location @myapp {
include uwsgi_params;
uwsgi_pass unix:/my/dir/uwsgi.sock;
}
}
my uwsgi.ini:
[uwsgi]
#application's base folder
base = /my/dir
#python module to import
app = app
module = %(app)
home = %(base)/venv
pythonpath = %(base)
#socket file's location
socket = /my/dir/%n.sock
#permissions for the socket file
chmod-socket = 666
#the variable that holds a flask application inside the module imported at line #6
callable = app
#location of log files
logto = /my/dir/log/%n.log
~
how i launch the uwsgi process:
/my/dir/venv/bin/uwsgi --ini /my/dir/uwsgi.ini
Best Answer
There are dozens of ways in which your stack (expecially without concurrency as you have configured it) could hang.
i suggest you to investigate why instead of bypassing it (with features like harakiri). Enable the uWSGI tracebacker to understand what is going on when the app is stuck:
http://uwsgi-docs.readthedocs.org/en/latest/Tracebacker.html