【问题标题】:GeventSocketIOWorker has no attribute 'socket'GeventSocketIOWorker 没有属性“套接字”
【发布时间】:2013-02-01 23:31:54
【问题描述】:

我需要使用 gunicorn 运行 Django 应用程序。 我阅读了文档,我认为我应该设置所有内容,但是当我运行时

gunicorn --worker-class socketio.sgunicorn.GeventSocketIOWorker app.wsgi:application

我收到以下错误消息

2013-02-01 18:25:17 [25394] [INFO] Booting worker with pid: 25394
2013-02-01 18:25:18 [25394] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File ".../app-root/data/lib/python2.7/site-packages/gunicorn/arbiter.py", line 485, in spawn_worker
    worker.init_process()
  File ".../app-root/data/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 131, in init_process
    super(GeventWorker, self).init_process()
  File ".../app-root/data/lib/python2.7/site-packages/gunicorn/workers/base.py", line 104, in init_process
    self.run()
  File ".../app-root/data/lib/python2.7/site-packages/socketio/sgunicorn.py", line 14, in run
    self.socket.setblocking(1)
AttributeError: 'GeventSocketIOWorker' object has no attribute 'socket'
Traceback (most recent call last):
  File ".../app-root/data/lib/python2.7/site-packages/gunicorn/arbiter.py", line 485, in spawn_worker
    worker.init_process()
  File ".../data/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 131, in init_process
    super(GeventWorker, self).init_process()
  File ".../app-root/data/lib/python2.7/site-packages/gunicorn/workers/base.py", line 104, in init_process
    self.run()
  File ".../app-root/data/lib/python2.7/site-packages/socketio/sgunicorn.py", line 14, in run
    self.socket.setblocking(1)
AttributeError: 'GeventSocketIOWorker' object has no attribute 'socket'
2013-02-01 18:25:18 [25394] [INFO] Worker exiting (pid: 25394)

如果我用 django_socketio 运行它,一切正常,我一定错过了一些非常重要的东西。

感谢您的帮助

【问题讨论】:

    标签: django socket.io gunicorn gevent-socketio


    【解决方案1】:

    似乎是 gunicorn>0.17 的问题,见issue #122。 对我来说,它适用于 gunicorn 的 0.16.1 版本。

    pip install gunicorn==0.16.1
    

    【讨论】:

    • 以防万一有人想知道,它是 2014 年 10 月,这个解决方案仍然有效。谢谢。
    【解决方案2】:

    安装 gevent-socketio 0.3.6 可能会解决此问题,而无需在某些情况下恢复 gunicorn。我有 0.3.5-rc2 并且升级为我解决了这个问题(注意:这不在 django 中,但它有效。)

    pip install gevent-socketio==0.3.6

    【讨论】:

      【解决方案3】:

      由 gunicorn 的这种变化引起。 https://github.com/benoitc/gunicorn/commit/9a83d719b23fe28667a9c76bac25ba66651f8ccf

      以前用于 gevent worker 的套接字来自 gunicorn 套接字,现在它们封装了 gevent 协作套接字。所以恢复到旧版本的 gunicorn 并不是一个好主意。可能正在禁用 Flash Policy Server,这将禁用此检查。

      【讨论】:

        猜你喜欢
        • 2014-05-15
        • 1970-01-01
        • 2020-11-16
        • 1970-01-01
        • 2018-10-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多