Gunicorn 因 OSError 失败:[Errno 107] 传输端点未连接

See*_*u S 9 python django gunicorn

Docker ImageOpenshift. 我没有使用 nginx 来设置 [secure_scheme_headers]:https : //github.com/benoitc/gunicorn/issues/1766

Gunicorn 配置

gunicorn --chdir /src/app wsgi:application --bind 0.0.0.0:8000 --workers 4 --timeout 180 -k gevent

错误

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base_async.py", line 66, in handle
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.7/site-packages/gunicorn/six.py", line 625, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base_async.py", line 49, in handle
    req = six.next(parser)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/http/parser.py", line 41, in __next__
    self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/http/message.py", line 181, in __init__
    super(Request, self).__init__(cfg, unreader)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/http/message.py", line 54, in __init__
    unused = self.parse(self.unreader)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/http/message.py", line 230, in parse
    self.headers = self.parse_headers(data[:idx])
  File "/usr/local/lib/python3.7/site-packages/gunicorn/http/message.py", line 74, in parse_headers
    remote_addr = self.unreader.sock.getpeername()
OSError: [Errno 107] Transport endpoint is not connected```

# Fix
I was able to fix the issue by shifting the older version of gunicorn==19.7.1
and gevent didn't work with the older version of the gunicorn.
https://github.com/benoitc/gunicorn/issues/1913
Run Code Online (Sandbox Code Playgroud)

小智 1

正如评论中提到的,这与#1993是同一问题,并在拉取请求#2277中修复。它已合并并在最新版本的 Gunicorn 版本20.1.0中提供

因此,通过更新到这个版本的 Gunicorn,问题就解决了。