Python的问题解决: IOError: [Errno 32] Broken pipe

简介:

错误一:

遇到一个很奇怪的问题, web.py代码里面报错

1
IOError: [Errno  32 ] Broken pipe

启动命令: 

1
nohup python xxx.py >> xxx.log &

ssh登录到机器上, 启动, 不会出现

远程ssh执行启动脚本, 就会出现IOError问题


查看进程pid, ll /proc/<pid>/fd 发现, stderr也就是fd为2的文件, 竟然是个pipe, 是个broken pipe, 错误的地方找到了


猜测可能是ssh登录过去, nohup会redirect stderr, 默认重定向到stdout, 不过ssh会话的stdout应该是pipe, 因为需要把输出从远端机器回传到本机

nohup把stderr重定向到了这个pipe上, 当ssh会话结束时, pipe自然会被关闭, 这样当程序代码中往stderr里面写入东西的时候, 就会报错了


错误二:


针对以上问题单机执行时候,发现不再报错,但是为了一定的处理,前面使用nginx作为反向代理,结果又出现

1
IOError: [Errno  32 ] Broken pipe


通过F12 发现,post 加载某个js 文件超时,并出现504 Time-out

检查js文件没有问题,

回忆,之前没有使用nginx前,此问题已经解决,为何突然又出现,

经过资料查询,使用以上nginx 配置解决

应该是读取时间设置过短,导致超时:

1
2
3
4
5
location  /  {
             proxy_read_timeout  300 ;
             ......
             .....
            }

这种问题,让人蛋疼。



      本文转自crazy_charles 51CTO博客,原文链接:http://blog.51cto.com/douya/1836848,如需转载请自行联系原作者



相关文章
|
9月前
|
安全 网络安全 API
python调用openai api报错self._sslobj.do_handshake()OSError: [Errno 0] Error
python调用openai api报错self._sslobj.do_handshake()OSError: [Errno 0] Error
264 1
python调用openai api报错self._sslobj.do_handshake()OSError: [Errno 0] Error
|
6月前
|
缓存 NoSQL 网络安全
【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
|
6月前
|
Linux Python Windows
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
【Azure 环境】Windows中安装Python azure-eventhub-checkpointstoreblob-aio模块时出错 ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
|
7月前
|
数据处理 开发者 Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘E:\自动备份文档\Python\修改配置.csv‘
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘E:\自动备份文档\Python\修改配置.csv‘
1380 1
|
7月前
|
UED Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’
276 0
|
7月前
|
XML 数据格式 Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘./1.xml’
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘./1.xml’
416 0
|
7月前
|
开发者 Python
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘配置信息.csv‘
【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘配置信息.csv‘
344 0
python-- 进程管道 Pipe、进程 Manager
python-- 进程管道 Pipe、进程 Manager
|
Docker Python 容器
解决docker 2022-11-16 14:54:26 python: can‘t open file ‘/src/main.py‘: [Errno 2]
解决docker 2022-11-16 14:54:26 python: can‘t open file ‘/src/main.py‘: [Errno 2]
239 0

热门文章

最新文章