推荐学习书目
› 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 · Aug 1, 2022 · 2005 views
    This topic created in 1519 days ago, the information mentioned may be changed or developed.
    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  
       Aug 2, 2022 via iPhone
    没遇到过。并且提供信息没办法推测
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2939 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:32 · PVG 20:32 · LAX 05:32 · JFK 08:32
    ♥ Do have faith in what you're doing.