使用 Python 修复 uWSGI 中的断管错误 [英] Fixing broken pipe error in uWSGI with Python

查看:92
本文介绍了使用 Python 修复 uWSGI 中的断管错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Python 中访问 REST 资源 (my_resource) 时,uWSGI 服务器在其日志中抛出以下错误:

While hitting a REST resource (my_resource) in Python, the uWSGI server is throwing the following error in its log:

SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request my_resource (ip <my_ip>) !!!
uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 164]
IOError: write error

这似乎与超时有关(客户端在请求完成处理之前断开连接).

It seems to be related to a timeout (the client disconnected before the request could finish processing).

这是什么类型的超时,如何修复?

What sort of timeout is this and how can it be fixed?

推荐答案

这取决于您的前端服务器.例如 nginx 有 uwsgi_read_timeout 参数.(一般设置为60秒).uWSGI http 路由器作为 --http-timeout 默认为 60 秒等等.当您在谈论休息 api 时,我很怀疑它需要超过 60 秒来生成响应,您确定您没有一些错误的响应标头触发前端网络服务器关闭的连接吗?

it depends on your frontend server. For example nginx has the uwsgi_read_timeout parameter. (generally set to 60 seconds). The uWSGI http router as the --http-timeout default to 60 seconds and so on. As you are talking about a rest api i am quite doubtful it requires more than 60 seconds to generate a response, are you sure you do not have some wrong response header triggering a connection close by the frontend webserver ?

这篇关于使用 Python 修复 uWSGI 中的断管错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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