在测试环境使用uwsgi启动flask未成功
正常报错信息:
*** Starting uWSGI 2.0.13.1 (64bit) on [Fri Sep 23 09:27:47 2016] ***
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-4) on 22 September 2016 11:24:15
os: Linux-2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013
nodename: localhost.localdomain
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/sae/pengyusong/saeServers/tcc
writing pidfile to ./tcc.pid
detected binary path: /home/sae/tools/python2.7.12/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 1024
your memory page size is 4096 bytes
detected max file descriptor number: 100000
lock engine: pthread robust mutexes
thunder lock: enabled
Listen queue size is greater than the system max net.core.somaxconn (128).
VACUUM: pidfile removed.
unlink(): No such file or directory [core/uwsgi.c line 1634]
从这里看不出什么问题,在网上找到一种方法可以看到具体错误信息如下:使用 strace -f [ -o trace.log ] uwsgi --ini uwsgi.ini
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 open("/proc/sys/net/core/somaxconn", O_RDONLY) = 4 read(4, "128\n", 16) = 4 close(4) = 0 write(2, "Listen queue size is greater tha"..., 75Listen queue size is greater than the system max net.core.somaxconn (128). ) = 75 chdir("/home/sae/pengyusong/saeServers/tcc") = 0 unlink("./tcc.pid") = 0 write(2, "VACUUM: pidfile removed.\n", 25VACUUM: pidfile removed. ) = 25 unlink("/tmp/stats_tcc.socket") = -1 ENOENT (No such file or directory) write(2, "unlink(): No such file or direct"..., 61unlink(): No such file or directory [core/uwsgi.c line 1634] ) = 61 exit_group(1)
从上述错误看到,可能是因为没有这个文件导致的出错,注意我说的是“可能”,因为实际上不是,这个可能就是一个检查,没有就会创建,真正的原因没打印出来。
找了半天,没办法,与生产环境上做对比,启动过程中一个输出引起了我的注意:
Listen queue size is greater than the system max net.core.somaxconn (128).
这句话说的是系统的这个参数设置为128,但是我的uwsgi配置的比较大,我自以为是的认为这个应该没关系,反正是测试环境,大不了就按照128限制来吧
没有办法,最后尝试改了以下这个参数,然后再次启动,奇迹般的启动成功了,成功了,了。。。。
计算机的世界套路太深,有时候不按常理出牌,也是因为自己对uwsgi不熟导致的
WTF。。。