【发布时间】:2015-09-17 18:20:48
【问题描述】:
我最近为我的 Flask 应用程序切换到 uWSGI,并且大部分情况下进展顺利。经常出现的一个奇怪现象是我会收到一堆形式的警告:
[WARNING] unable to add HTTP_X_FORWARDED_PROTO=https to uwsgi packet, consider increasing buffer size
[WARNING] unable to add HTTP_X_FORWARDED_PORT=443 to uwsgi packet, consider increasing buffer size
[WARNING] unable to add HTTP_X_FORWARDED_PORT=443 to uwsgi packet, consider increasing buffer size
[WARNING] unable to add HTTP_X_FORWARDED_PORT=443 to uwsgi packet, consider increasing buffer size
[WARNING] unable to add HTTP_X_FORWARDED_PORT=443 to uwsgi packet, consider increasing buffer size
[WARNING] unable to add HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 to uwsgi packet, consider increasing buffer size
并且遵循足够的这些,我会得到这些:
Tue Sep 15 16:57:48 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:49 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:50 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:51 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:52 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:53 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:54 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:55 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:56 2015 - [DANGER] async queue is full !!!
Tue Sep 15 16:57:57 2015 - [DANGER] async queue is full !!!
此时我的服务器会停止响应请求,直到它重新启动。
这往往会跟随某人向服务器发送一堆虚假的长废话查询,例如:
GET /autocomplete/5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555
我在 Nginx 后面运行 uWSGI。这是我的配置:
[uwsgi]
socket = 0.0.0.0:1234
protocol = http
wsgi-file = path/to/wsgi_server.py
callable = my_app
processes = 1
threads = 1
enable-threads = true
single-interpreter = true
async = 15
uGreen = true
logto = /path/to/my_log_file.log
有什么想法吗?
注意:我无法增加进程或线程的数量,因为我要为每个线程加载一个非常大的数据结构,这会占用太多内存而无法多次加载。
【问题讨论】: