【Bug】gunicorn 19.9.0版本出现“OSError: [Errno 11] Resource temporaril

Abbey部署Flask网站的时候,通常是:Flask+gunicorn+supervisor+nginx组合起来用,但是今天Abbey部署__Atc Pro__(Atc带后台版本)时,出现了__js无法加载__的问题

问题描述

Abbey将Atc部署到服务器上之后,运行了一下网站,发现前端无法加载webuploader.js文件,然后__浏览器__给出的__错误提示__是:

ERR_CONTENT_LENGTH_MISMATCH 200

然后,__后台运行的错误日志__是:

[2018-12-18 15:45:22 +0000] [2080] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/base_async.py", line 66, in handle
    six.reraise(*sys.exc_info())
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/base_async.py", line 56, in handle
    self.handle_request(listener_name, req, client, addr)
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/base_async.py", line 129, in handle_request
    six.reraise(*sys.exc_info())
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/base_async.py", line 112, in handle_request
    resp.write_file(respiter)
  File "/usr/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 403, in write_file
    if not self.sendfile(respiter):
  File "/usr/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 393, in sendfile
    sent += sendfile(sockno, fileno, offset + sent, count)
  File "/usr/lib/python2.7/site-packages/gunicorn/http/_sendfile.py", line 66, in sendfile
    raise OSError(e, os.strerror(e))
OSError: [Errno 11] Resource temporarily unavailable

问题解决

在网上搜了一下,基本上都说是__线程太多__,可以尝试编辑/etc/security/limits.d/20-nproc.conf来解决。但是这个办法亲测失败了;

然后也有说是js文件时UTF-8(BOM)格式导致的,但是用notepad++看了下编码,不是UTF-8(BOM)

最后在v2ex上翻到一个说是gunicorn的bug,升级到19.3.0版本即可;

于是升级一下gunicorn

pip install -U gunicorn

然后提示gunicorn已经是最新版本:

Requirement already up-to-date: gunicorn in /usr/lib/python2.7/site-packages (19.9.0)

但是,一个是19.9.0版本,前面说的是19.3.0版本,版本不符,遂降级试试:

pip install gunicorn==19.3.0

然后再运行网站,就没有问题了!

不知道这是什么BUG,解决了就行了。

本文作者:Abbey

本文链接:https://www.abbeyok.com/archives/244

版权声明:本博客所有文章除特别声明外,均采用CC BY-NC-SA 3.0许可协议。转载请注明出处!

【Atc】Abbey微博图床上传网站开源... <<
0 条评论

请先登陆注册

已登录,注销 取消