这看起来像是 Nginx+uWSGI 超时的一个众所周知的问题,但我的设置不同,我找不到有关它的信息。
我在 uWSGI 上运行 Flask 应用程序,使用 http 协议(不是套接字)。当我查询 API 时,有时会收到错误消息:
uwsgi_response_write_body_do() TIMEOUT !!!
IOError: : write error
Run Code Online (Sandbox Code Playgroud)
我在“工作时间”收到它的频率更高,即在晚上不那么频繁。我正在查询长 JSON 数据(地理坐标,最多 50 MB),有时我根本没有得到响应,有时我得到了部分响应。这些是来自 Pythonrequests请求的错误:
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))
ValueError: Expecting object: line 1 column 5590371 (char 5590370)
ValueError: Unterminated string starting at: line 1 column 20998536 (char 20998535)
ValueError: end is out of bounds
# when I set `timeout=None` in Python
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='mydomain.com', port=80): …Run Code Online (Sandbox Code Playgroud)