【发布时间】:2021-10-11 01:59:12
【问题描述】:
上下文: 我正在使用 Ubuntu 20.4 vps 和 Apache2 来使用烧瓶托管深度学习模型。
我需要从图像中写一个视频,我用过
imageio.mimsave(path, [img_as_ubyte(frame) for frame in predictions], fps=fps)
当我使用 flask-ngrok 对其进行测试时,它可以工作。但是在使用 WSGI 和 apache2 服务器在烧瓶上部署之后,它给了我这个 Broken pipe 错误。奇怪!
Apache2的错误日志:
ERROR:model:Exception on / [POST], referer: host ip [wsgi:error] [pid 1029:tid 140257565120256] Traceback (最近一次通话最后):, referer: http:/// [wsgi:error] [pid 1029:tid 140257565120256] 文件“/usr/local/lib/python3.8/dist-packages/imageio_ffmpeg/_io.py”,第 493 行,在 write_frames,引用者:主机 ip [wsgi:error] [pid 1029:tid 140257565120256] p.stdin.write(bb), referer: http:/// [wsgi:error] [pid 1029:tid 140257565120256] BrokenPipeError: [Errno 32] Broken pipe, referer: host ip [wsgi:error] [pid 1029:tid 140257565120256],参考:http:/// [Wed Aug 04 16:36:27.857233 2021] [wsgi:error] [pid 1029:tid 140257565120256] 在处理上述异常的过程中,又发生了一个异常:,referer:http:// [2021 年 8 月 4 日星期三 16:36:27.857238] [wsgi:error] [pid 1029:tid 140257565120256] [client],参考:http:/// [2021 年 8 月 4 日星期三 16:36:27.857243] [wsgi:error] [pid 1029:tid 140257565120256] [client 3] Traceback (最近一次通话最后一次):,referer: http:/// [2021 年 8 月 4 日星期三 16:36:27.857250] [wsgi:error] [pid 1029:tid 140257565120256] [client] 文件“/usr/local/lib/python3.8/dist-packages/flask/app.py”,第 2070 行,在 wsgi_app 中,引用:http:/// [2021 年 8 月 4 日星期三 16:36:27.857256] [wsgi:error] [pid 1029:tid 140257565120256] [client] response = self.full_dispatch_request(), referer: http:/// [2021 年 8 月 4 日星期三 16:36:27.857261] [wsgi:error] [pid 1029:tid 140257565120256] [client] 文件“/usr/local/lib/python3.8/dist-packages/flask/app.py”,第 1515 行,在 full_dispatch_request 中,引用者:http:/// [2021 年 8 月 4 日星期三 16:36:27.857266] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] rv = self.handle_user_exception(e), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857272] [wsgi:error] [pid 1029:tid 140257565120256] [客户端客户端 ip] 文件“/usr/local/lib/python3.8/dist-packages/flask/app.py ",第 1513 行,在 full_dispatch_request 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857277] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] rv = self.dispatch_request(), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857294] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] 文件“/usr/local/lib/python3.8/dist-packages/flask/app.py” ,第 1499 行,在 dispatch_request 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857300] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args), referer : 主机ip [2021 年 8 月 4 日星期三 16:36:27.857306] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] 文件“/var/www/html/model/model/Model/model.py”,第 48 行,在预测中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857311] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] imageio.mimsave('/home/administrator/model/model/Model/outputs/generated.mp4', [img_as_ubyte(frame) for frame in predictions], fps=fps), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857317] [wsgi:error] [pid 1029:tid 140257565120256] [客户端 ip] 文件“/usr/local/lib/python3.8/dist-packages/imageio/core/functions. py",第 418 行,在 mimwrite 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857322] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] writer.append_data(im), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857327] [wsgi:error] [pid 1029:tid 140257565120256] [客户端 ip] 文件“/usr/local/lib/python3.8/dist-packages/imageio/core/format. py”,第 502 行,在 append_data 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857332] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] return self._append_data(im, total_meta), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857337] [wsgi:error] [pid 1029:tid 140257565120256] [客户端 ip] 文件“/usr/local/lib/python3.8/dist-packages/imageio/plugins/ffmpeg. py",第 574 行,在 _append_data 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857342] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] self._write_gen.send(im), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857347] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] 文件“/usr/local/lib/python3.8/dist-packages/imageio_ffmpeg/_io.py” ,第 500 行,在 write_frames 中,引用者:主机 ip [2021 年 8 月 4 日星期三 16:36:27.857353] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] raise IOError(msg), referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857358] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] OSError: [Errno 32] Broken pipe, referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857363] [wsgi:error] [pid 1029:tid 140257565120256] [client ip],referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857367] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] FFMPEG COMMAND:, referer: host ip [2021 年 8 月 4 日星期三 16:36:27.857373] [wsgi:error] [pid 1029:tid 140257565120256] [client ip] /usr/local/lib/python3.8/dist-packages/imageio_ffmpeg/binaries/ffmpeg-linux64- v4.2.2 -y -f rawvideo -vcodec rawvideo -s 256x256 -pix_fmt rgb24 -r 20.00 -i - -an -vcodec libx264 -pix_fmt yuv420p -crf 25 -v 警告 /home/administrator/model/model/Model/outputs/生成的.mp4,referer:主机ip [wsgi:error] [pid 1029:tid 140257565120256] [client ip] , referer: http:/// [wsgi:error] [pid 1029:tid 140257565120256] [client ip] FFMPEG STDERR OUTPUT:,referer: [wsgi:error] [pid 1029:tid 140257565120256] [client ip] , referer: host ip
【问题讨论】:
标签: python flask apache2 mod-wsgi wsgi