【发布时间】:2018-05-30 13:25:34
【问题描述】:
我有一个 Flask Uwsgi 部署
到今天为止一切正常
Curl 到服务器会得到下面
curl http://ip:5000/api -i
curl: (52) Empty reply from server
uwsgi日志如下所示(请不要再说check log了。日志已经在这里了)
[pid: 15778|app: 0|req: 552000/854000] 8.8.8.8 () {22 vars in 241 bytes} [Wed May 30 16:40:51 2018] HEAD / => generated 0 bytes in 0 msecs (HTTP/1.0 404) 2 headers in 72 bytes (0 switches on core 0)
...The work of process 15778 is done. Seeya!
worker 1 killed successfully (pid: 15778)
Respawned uWSGI worker 1 (new pid: 18478
另外,这个问题与问题不重复 Django, uWSGI & nginx: Process dies for "no reason"
那个原因是他有设定
--max-requests 10
而且他没有大师设置。所以在他的日志中你可以看到 req 1000/1000 达到了限制。我的不是!!!
我在我的 conf 中设置了 master=true,你也可以从 wsgi 日志中看到。没有达到最大请求!!!
uwsgi的配置如下
[uwsgi]
socket = /opt/CephMGRServer/ceph_mgr_server/var/tmp/uwsgi.sock
http= 0.0.0.0:5000
chdir=/opt/CephMGRServer/ceph_mgr_server
wsgi-file = app.py
callable=app
master = true
processes=2
threads=2
max-requests=2000
chmod-socket=664
vacuum=true
daemonize = /opt/CephMGRServer/ceph_mgr_server/var/log/uwsgi.log
我可以看到进程仍然存在并且正在监听 5000 端口
ps -ef | grep wsgi| grep -v grep| grep -v tail
root 2083 22075 0 May28 ? 00:00:00 uwsgi --ini /opt/CephMGRServer/ceph_mgr_server/conf/wsgi.ini
root 18478 22075 0 16:40 ? 00:00:00 uwsgi --ini /opt/CephMGRServer/ceph_mgr_server/conf/wsgi.ini
root 22075 1 0 May24 ? 00:02:50 uwsgi --ini /opt/CephMGRServer/ceph_mgr_server/conf/wsgi.ini
root 22090 22075 0 May24 ? 00:01:48 uwsgi --ini /opt/CephMGRServer/ceph_mgr_server/conf/wsgi.ini
虽然值得注意的是监听5000和uwsgi只有两个进程有4个进程
lsof -i:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
uwsgi 22075 root 3u IPv4 76455578 0t0 TCP *:commplex-main (LISTEN)
uwsgi 22090 root 3u IPv4 76455578 0t0 TCP *:commplex-main (LISTEN)
那么 uwsig 发生了什么以及如何检查?
【问题讨论】:
-
首先检查日志:/opt/CephMGRServer/ceph_mgr_server/var/log/uwsgi.log
-
@gbajson 问题中已经包含的日志信息。
-
@Fian NO.我看到了那个问题。那个问题是 req 1000/1000 达到了限制。这个不是
-
这有什么更新吗?面临类似的问题。