invalid request block size: 5002 (max 4096)...skip [uwsgi-http key: 8.134.105.234:8997 client_addr: 120.82.117.43 client_port: 30236] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
invalid request block size: 5002 (max 4096)...skip [uwsgi-http key: 8.134.105.234:8997 client_addr: 120.82.117.43 client_port: 30236] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
*** Starting uWSGI 2.0.23 (64bit) on [Sun Dec 24 11:15:07 2023] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-44) on 24 December 2023 01:56:11
os: Linux-3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023
nodename: iZ7xv8mogva8558vhl5p1lZ
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /www/server/panel
writing pidfile to /www/wwwroot/mysite/uwsgi.pid
detected binary path: /www/server/pyporject_evn/mysite_venv/bin/uwsgi
setgid() to 1000
setuid() to 1000
chdir() to /www/wwwroot/mysite
your processes number limit is 6942
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:8997 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:35150 (port auto-assigned) fd 3
Python version: 3.7.9 (default, Dec 24 2023, 09:50:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Python main interpreter initialized at 0x258bc00
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 703600 bytes (687 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x258bc00 pid: 24601 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 24601)
spawned uWSGI worker 1 (pid: 24607, cores: 2)
spawned uWSGI worker 2 (pid: 24608, cores: 2)
spawned uWSGI worker 3 (pid: 24610, cores: 2)
spawned uWSGI worker 4 (pid: 24611, cores: 2)
spawned uWSGI http 1 (pid: 24613)
SIGINT/SIGTERM received...killing workers...
gateway "uWSGI http 1" has been buried (pid: 24613)
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
worker 4 buried after 1 seconds
goodbye to uWSGI.
*** Starting uWSGI 2.0.23 (64bit) on [Sun Dec 24 11:15:18 2023] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-44) on 24 December 2023 01:56:11
os: Linux-3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023
nodename: iZ7xv8mogva8558vhl5p1lZ
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /www/server/panel
writing pidfile to /www/wwwroot/mysite/uwsgi.pid
detected binary path: /www/server/pyporject_evn/mysite_venv/bin/uwsgi
setgid() to 1000
setuid() to 1000
chdir() to /www/wwwroot/mysite
your processes number limit is 6942
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:8997 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:38437 (port auto-assigned) fd 3
Python version: 3.7.9 (default, Dec 24 2023, 09:50:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Python main interpreter initialized at 0x1a5cbd0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 416880 bytes (407 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1a5cbd0 pid: 24699 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 24699)
spawned uWSGI worker 1 (pid: 24705, cores: 2)
spawned uWSGI worker 2 (pid: 24707, cores: 2)
spawned uWSGI worker 3 (pid: 24709, cores: 2)
spawned uWSGI worker 4 (pid: 24710, cores: 2)
spawned uWSGI http 1 (pid: 24711)
invalid request block size: 4970 (max 4096)...skip
[uwsgi-http key: 8.134.105.234:8997 client_addr: 120.82.117.43 client_port: 2844] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647]
invalid request block size: 4970 (max 4096)...skip
解决方法:
根目录的uwsgi.ini文件里面加入这个
buffer-size = 32768
完整:
[uwsgi]
#项目目录
chdir=/www/wwwroot/mysite
#指定项目application
wsgi-file=/www/wwwroot/mysite/mysite/wsgi.py
# 进程个数
processes=4
# 线程个数
threads=2
#指定启动时的pid文件路径(用于停止服务和重启服务,请勿删除)
pidfile=/www/wwwroot/mysite/uwsgi.pid
# 指定ip及端口
# 默认http模式,可切换至socket模式
http=0.0.0.0:8997
#socket=0.0.0.0:8997
#启动uwsgi的用户名和用户组
uid=www
gid=www
#启用主进程
master=true
# 后台运行,并输出日志
daemonize = /www/wwwroot/mysite/uwsgi.log
buffer-size = 32768
# 自定义设置项请写到该处,
# 如果项目的启动方式您不想使用 wsgi-file 请注释掉,但不要删除,通讯方式(http, socket)同理;
# 最好以上面相同的格式 <注释 + 换行 + key = value> 进行书写,方便以后查阅
然后重启项目
如果上面的说法不生效,可以试试下面的配置
在nginx.conf文件中添加以下配置:
uwsgi_buffer_size 16k;
uwsgi_busy_buffers_size 24k;