This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients Christian Exposito, asvetlov, christian.heimes, python-dev, yselivanov
Date 2020-05-28.18:55:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590692111.53.0.991314997789.issue40811@roundup.psfhosted.org>
In-reply-to
Content
The default policy of asyncio deliberately limits automatic creation of event loops to the main thread. You can't just mix asyncio with a threaded web application and expect it to work correctly.

See https://github.com/python/cpython/blob/a487a39dca4c41305928c7dfdbcb0b3aa344683b/Lib/asyncio/events.py#L609-L620

    In this policy, each thread has its own event loop.  However, we
    only automatically create an event loop by default for the main
    thread; other threads by default have no event loop.

    Other policies may have different rules (e.g. a single global
    event loop, or automatically creating an event loop per thread, or
    using some other notion of context to which an event loop is
    associated).
History
Date User Action Args
2020-05-28 18:55:11christian.heimessetrecipients: + christian.heimes, asvetlov, python-dev, yselivanov, Christian Exposito
2020-05-28 18:55:11christian.heimessetmessageid: <1590692111.53.0.991314997789.issue40811@roundup.psfhosted.org>
2020-05-28 18:55:11christian.heimeslinkissue40811 messages
2020-05-28 18:55:11christian.heimescreate