使用 gunicorn 部署烧瓶应用程序每次都会抛出 OSError: [Errno 0] Error
。
下面是错误:
[2021-06-28 12:00:21 +0000] [11] [ERROR] Socket error processing request.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/gunicorn/workers/sync.py", line 135, in handle
req = next(parser)
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/parser.py", line 42, in __next__
self.mesg = self.mesg_class(self.cfg, self.unreader, self.source_addr, self.req_count)
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 180, in __init__
super().__init__(cfg, unreader, peer_addr)
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 54, in __init__
unused = self.parse(self.unreader)
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 192, in parse
self.get_data(unreader, buf, stop=True)
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/message.py", line 183, in get_data
data = unreader.read()
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/unreader.py", line 37, in read
d = self.chunk()
File "/usr/local/lib/python3.8/dist-packages/gunicorn/http/unreader.py", line 64, in chunk
return self.sock.recv(self.mxchunk)
File "/usr/lib/python3.8/ssl.py", line 1226, in recv
return self.read(buflen)
File "/usr/lib/python3.8/ssl.py", line 1101, in read
return self._sslobj.read(len)
OSError: [Errno 0] Error
环境详情:
Python 版本:Python 3.8.5
guncorn 模块版本:20.0.4
gunicorn 配置文件:
"""Gunicorn configurations."""
import os
bind = "0.0.0.0:443"
workers = os.cpu_count() - 1
keyfile = "/home/xyz/certs/psa_xyz.key"
certfile = "/home/xyz/certs/psa_xyz.crt"
timeout = 120
答案 0 :(得分:0)
其他应用程序已经在使用该端口,或者您的防火墙问题阻止您访问该端口。要确认这一点,您可以尝试将端口更改为 5000。
所以你的配置应该是这样的。
"""Gunicorn configurations."""
import os
bind = "0.0.0.0:5000"
workers = os.cpu_count() - 1
keyfile = "/home/xyz/certs/psa_xyz.key"
certfile = "/home/xyz/certs/psa_xyz.crt"
timeout = 120