PyOne icon indicating copy to clipboard operation
PyOne copied to clipboard

gevent的hub调度器异常

Open Creling opened this issue 6 years ago • 1 comments

使用如下配置的gunicorn运行pyone时,抛出以下异常

LoopExit: This operation would block forever
	Hub: <Hub '' at 0x7faf84c15f70 epoll default pending=0 ref=0 fileno=11 thread_ident=0x7faf91a1d740>
	Handles:

程序栈如下:

Traceback (most recent call last):
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gevent/builtins.py", line 96, in __import__
    result = _import(*args, **kwargs)
  File "/opt/PyOne/run.py", line 6, in <module>
    from app import create_app
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gevent/builtins.py", line 96, in __import__
    result = _import(*args, **kwargs)
  File "/opt/PyOne/app/__init__.py", line 6, in <module>
    from utils.header import GetConfig
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gevent/builtins.py", line 96, in __import__
    result = _import(*args, **kwargs)
  File "/opt/PyOne/app/utils/__init__.py", line 2, in <module>
    from file_os import *
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gevent/builtins.py", line 96, in __import__
    result = _import(*args, **kwargs)
  File "/opt/PyOne/app/utils/file_os.py", line 2, in <module>
    from header import *
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/gevent/builtins.py", line 96, in __import__
    result = _import(*args, **kwargs)
  File "/opt/PyOne/app/utils/header.py", line 43, in <module>
    mongo = MongoClient(host=GetConfig_pre('MONGO_HOST'),port=int(GetConfig_pre('MONGO_PORT')),connect=False)
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/pymongo/mongo_client.py", line 622, in __init__
    executor.open()
  File "/opt/PyOne/PyOne_venv/lib/python2.7/site-packages/pymongo/periodic_executor.py", line 83, in open
    thread.start()
  File "/usr/lib64/python2.7/threading.py", line 752, in start
    self.__started.wait()
  File "src/gevent/event.py", line 127, in gevent._event.Event.wait
  File "src/gevent/_abstract_linkable.py", line 192, in gevent.__abstract_linkable.AbstractLinkable._wait
  File "src/gevent/_abstract_linkable.py", line 165, in gevent.__abstract_linkable.AbstractLinkable._wait_core
  File "src/gevent/_abstract_linkable.py", line 169, in gevent.__abstract_linkable.AbstractLinkable._wait_core
  File "src/gevent/_greenlet_primitives.py", line 60, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 60, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 64, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch

Creling avatar Jun 01 '19 14:06 Creling

那就不要用gevent/eventlet运行,可能会影响部分功能

2024baibai avatar Jun 01 '19 15:06 2024baibai