V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hhhhhh123
V2EX  ›  Python

gunicorn + worker_class 除了默认 sync,像 gevent, eventlet 都无法使用

  •  
  •   hhhhhh123 · 2022-08-01 18:22:07 +08:00 · 1054 次点击
    这是一个创建于 605 天前的主题,其中的信息可能已经有所发展或是发生改变。
    gunicorn -b 0.0.0.0:5000 app:app --worker-class gevent --timeout 120
    

    我只有使用 worker-class sync 我才能请求成功,其他模式就是 等将近一分钟才能返回 502 Bad Gateway ,代码也没有报错。这问题到底在哪???

    我目前推测是 使用 gevent 或 eventlet 被阻塞了,一直没有成功运行,但是也感觉不是这样 很头大

    下面是 gevent 模式运行, 一直卡在这, 如果是 sync 模式,我代码中的打印信息好歹会打印。所以我推测是 阻塞,但是不知道为啥........

    [2022-08-01 10:12:11 +0000] [3170259] [INFO] Starting gunicorn 20.1.0
    [2022-08-01 10:12:11 +0000] [3170259] [INFO] Listening at: http://0.0.0.0:5000 (3170259)
    [2022-08-01 10:12:11 +0000] [3170259] [INFO] Using worker: gevent
    [2022-08-01 10:12:11 +0000] [3170260] [INFO] Booting worker with pid: 3170260
    
    cz5424
        1
    cz5424  
       2022-08-02 09:32:54 +08:00 via iPhone
    没遇到过。并且提供信息没办法推测
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4031 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:59 · PVG 08:59 · LAX 17:59 · JFK 20:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.