【问题标题】:Gunicorn is failing with OSError: [Errno 107] Transport endpoint is not connectedGunicorn 因 OSError 失败:[Errno 107] 传输端点未连接
【发布时间】:2020-02-11 19:28:53
【问题描述】:

我在使用Openshift 中的 gunicorn 版本 19.9.0 运行我的应用程序 [Docker Image] 时遇到了这个问题。我没有使用 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

【问题讨论】:

  • 这里没有足够的信息。您使用的是什么 gunicorn 配置?
  • 使用单个命令运行没有太多配置
  • 看起来像这个问题#1913。尚未修复。
  • @dirkgroten 当我使用 Docker Image 在 Opeshift 中运行应用程序时出现问题。上面是 Gunicorn 运行命令作为入口。
  • Gunicorn 使用 gunicorn==19.7.1 没有任何问题。根本原因gunicorn版本,去老版本后问题解决了。

标签: python django gunicorn


【解决方案1】:

正如 cmets 中所述,这与 #1993 相同,并且在拉取请求 #2277 中已修复。它在最新版本的 Gunicorn 中合并并可用,版本 20.1.0

所以通过更新到这个版本的 Gunicorn,我的问题就解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-20
    • 2016-01-13
    • 1970-01-01
    • 2015-06-23
    • 2018-11-06
    • 2012-08-11
    相关资源
    最近更新 更多