uwsgi会抛出由uwsgi_response_write_body_do断线引起的IO错误 [英] uwsgi throws IO error caused by uwsgi_response_write_body_do broken pipe

查看:4857
本文介绍了uwsgi会抛出由uwsgi_response_write_body_do断线引起的IO错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序由uwsgi + django部署,我使用gevent进行性能测试,它同时运行1200个请求,uwsgi会抛出IO错误,日志信息是:

  uwsgi_response_write_body_do():Broken pipe [core / writer.c line 260] 
IOError:写入错误

Django 1.4.0

uwsgi:1.9.13

python:2.6

TCP侦听队列:1000



一个想法会导致这个问题的原因?

解决方案

当NGINX开始向uWSGI发出请求,但是uWSGI花费的时间太长,则NGINX会关闭与uWSGI的连接。当uWSGI终于完成时,它试图将其回应给NGINX,但是NGINX早先关闭了连接,所以uWSGI会抛出一个I / O错误。



所以这可以意味着你的uWSGI进程花费太长时间。



更新:



uWSGI的Harakiri模式可能对自动有用终止这样长时间的处理,如果你想:
https://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#what-is-harakiri-mode
您可能不想这样做,因为进程可能要完成一些长时间的查询或必要的事情。


My application deploy by uwsgi+django, I use gevent to do performance testing, it run 1200 request concurrently, uwsgi will throw IO error, the log information is:

uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 260]
IOError: write error

Django 1.4.0
uwsgi: 1.9.13
python: 2.6
TCP Listen queue: 1000

An idea what reason will cause this issue?

解决方案

This can happen when NGINX started a request to uWSGI but uWSGI took too long to respond, then NGINX closes the connection to uWSGI. When uWSGI finally finishes, it tries to give it's response back to NGINX, but NGINX closed the connection earlier, so then uWSGI throws an I/O error.

So this could mean that your uWSGI process is taking too long.

Update:

uWSGI's Harakiri mode could be useful to automatically terminate such long taking processes if you want to: https://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#what-is-harakiri-mode You might not want to do this because a process might be finishing some long query or something which is necessary.

这篇关于uwsgi会抛出由uwsgi_response_write_body_do断线引起的IO错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆