Skip to content

asyncio is not compatible with gevent #5817

@awoimbee

Description

@awoimbee

See #5256

async-await: https://flask.palletsprojects.com/en/stable/async-await/

Using async with greenlet
When using gevent or eventlet to serve an application or patch the runtime, greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 is required.

Flask uses asgiref, which is not compatible with gevent: django/asgiref#443

BTW:
ASGI: https://flask.palletsprojects.com/en/stable/deploying/asgi/

The asgiref WsgiToAsgi adapter is recommended as it integrates with the event loop used for Flask’s Using async and await support.

This makes it seem like the event loop integration means a single worker could process multiple requests concurently, which it can't, the worker will block on await.


I'm not the only one that found this the hard way: Flask, Gunicorn, Gevent and Asyncio Don't Mix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions