api - NGINX / Gunicorn / Flask - 上传适量数据时出现“502 Bad Gateway”和“sendfail() failed (32: Broken pipe)”
问题描述
我有一个使用 NGNIX 和 Gunicorn 托管在 Ubuntu 服务器上的 Flask API。
当发送带有少量数据的 POST 请求时,一切都很顺利。
但是,当发送的数据接近 100KB(例如一个大约 100,000 个字符的字符串)时,NGINX 会以 502 Bad Gateway 响应,并且其错误日志(/var/log/nginx/error.log)包含“sendfile() failed (32: Broken管道)同时向上游发送请求”。
“上游”是 Unix 套接字上的 Flask API。
如果将相同数量的数据分解为一系列快速连续发出的较小请求,则一切正常。发送的数据没有损坏。
此错误的可能原因是什么?
解决方案
推荐阅读
- react-native - 如何在 React Native 中将数组分配为对象的属性?
- maven - Jenkinsfile:是否允许使用 sh 子shell?
- node.js - 为什么我的主页在发布后不显示?
- excel - 导入 html 网页表格
- php - Laravel 无缓冲查询是活动错误
- node.js - 服务器在发送具有多个文本输入的输入文件时出现 500 错误
- flutter - 使用剪辑路径创建圆角
- assembly - 如何在 LC-3 汇编语言中取反寄存器中的值?
- dynamic - 是否有任何服务可以在使用静态 IP 时模拟动态 IP?
- python - 如何将类方法的输出打印到控制台?