gpt4 book ai didi

python - uWSGI 错误 hr_instance_read() : Connection reset by peer

转载 作者:行者123 更新时间:2023-12-04 02:28:58 26 4
gpt4 key购买 nike

我已经使用 uWSGI 和 NGINX 作为反向代理部署了一个 Flask Web 应用程序。应用程序响应时间平均约为 9 毫秒,但在我的工作人员崩溃的一批请求之后,我在我的 uWSGI 日志中得到了这个日志:

[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 24488] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 4059] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 46764] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 9951] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 9449] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 51355] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 39565] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 63142] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 7861] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 10165] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 10917] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 20392] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]

uWSGI 配置:
[uwsgi]
http = 0.0.0.0:7000
wsgi-file = app.py
callable = app
processes = 5
lazy = true
lazy-apps = true
buffer-size = 16384
logto = /root/logs/data-gathering.log

邮箱:
uWSGI==2.0.17
Flask==0.12.2

最佳答案

我对 uWSGI 原生 HTTP 服务器有同样的问题。使用以下配置:

https = :8443,app.crt,app.key,HIGH,!ca.crt
http-workers = 2
http-buffer-size = 32768

; applications
mount = /=/app.py
mount = /asq=/asq.py

; process managment
master = true
vacuum = true
single-interpreter = true
pidfile = /tmp/uwsgi.pid
enable-threads = true
cpu-affinity = 1
processes = 4
threads = 2
offload-threads = 1

close-on-exec = true
buffer-size = 32768

我总是得到:
[uwsgi-http key: 192.168.1.200:8443 client_addr: 192.168.1.200 client_port: 20179] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]

就我而言,我正在表演 发布 请求而不消耗 body 。所以在添加 post-buffering = 1 之后到配置一切刚刚开始工作正常。没有标志的相同结果,只是阅读 发布 数据。

来自 uWSGI 的“要知道的事情”:

If an HTTP request has a body (like a POST request generated by a form), you have to read (consume) it in your application. If you do not do this, the communication socket with your webserver may be clobbered. If you are lazy you can use the post-buffering option that will automatically read data for you. For Rack applications this is automatically enabled.

关于python - uWSGI 错误 hr_instance_read() : Connection reset by peer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50189365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com