uwsgi-http hr_instance_read(): Connection reset by peer - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
vegetableChick
V2EX    Python

uwsgi-http hr_instance_read(): Connection reset by peer

  •  
  •   vegetableChick 2022-08-11 17:17:57 +08:00 2625 次点击
    这是一个创建于 1232 天前的主题,其中的信息可能已经有所发展或是发生改变。

    服务是 nginx + uwsgi + Django 搭建的

    有一个上传图片的接口, 通过multipart/form-data 上传到后端服务器 文件大小超过一定大小(大概是 3M 多)就会报错

    [uwsgi-http key: host client_addr: addr client_port: 27198] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] 

    以下是一些相关的配置:

    uwsgi config

    [uwsgi] pythOnpath=/path/to/pythonpath chdir=/path/to/chdir env=DJANGO_SETTINGS_MODULE=conf.settings module=moudle.wsgi master=True pidfile=logs/pidfile.pid vacuum=True max-requests=1000 enable-threads=true processes = 4 threads=8 reload-on-rss=2048 listen=1024 daemOnize=logs/wsgi.log http=0.0.0.0:16020 buffer-size=32000 socket-timeout=1500 harakiri=1500 http-timeout=1500 
    nginx config

    nginx.conf

    worker_processes 12; events { use epoll; worker_connections 65535; } http { include mime.types; include log_format.conf; include upstream.conf; default_type application/octet-stream; sendfile on; tcp_nopush on; keepalive_timeout 1800; server_tokens off; client_max_body_size 100m; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 5; gzip_types text/plain application/json application/Javascript application/x-Javascript text/css application/xml text/Javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; include "site-enabled/*.conf"; } 

    log_format.conf

    log_format upstream '$remote_addr - $host [$time_local] "$request" ' '$status $body_bytes_sent $request_time $upstream_response_time ' '"$http_user_agent" "$http_x_forwarded_for" '; 

    upstream.conf

     upstream my_service { server host:16020 weight=50; server host:16020 weight=50; keepalive 100; } 

    site-enabled/my_service.conf

    server { listen 7020; server_name my-service.xxx.cn; client_max_body_size 100M; access_log logs/my_service_access.log upstream; root /path/to/my_service/dist; location ^~ /api/base_api { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 90; proxy_pass http://my_service; } location / { try_files $uri /index.html =404; } } 

    调用上传 api 后 uwsgi响应

    [pid: 32248|app: 0|req: 302/351] xxxx () {60 vars in 1502 bytes} [Thu Aug 11 17:14:06 2022] POST /api/ka/user_open/tt_upload_br => generated 26 bytes in 34 msecs (HTTP/1.0 400) 5 headers in 160 bytes (1 switches on core 2) [uwsgi-http key: host client_addr: addr client_port: 27198] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] 

    nginx响应

    xxx - host [11/Aug/2022:17:14:07 +0800] "POST /api/ka/user_open/tt_upload_br HTTP/1.1" 400 26 0.983 0.543, 0.407 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" "43.129.163.247" 

    是哪里限制了上传文件的大小呢, 请大家帮忙看一下?

    请大家帮忙看一下, 谢谢了!

    目前尚无回复
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     951 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 34ms UTC 22:38 PVG 06:38 LAX 14:38 JFK 17:38
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86