From: Ben Darnell Date: Sat, 5 May 2018 18:26:52 +0000 (-0400) Subject: wsgi: Document workaround for asyncio on multithreaded WSGI containers X-Git-Tag: v5.1.0b1~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16a3567b68f23ae4386eaf881f6a8584968d33d9;p=thirdparty%2Ftornado.git wsgi: Document workaround for asyncio on multithreaded WSGI containers Fixes #2371 --- diff --git a/tornado/wsgi.py b/tornado/wsgi.py index 892c0a929..beda0b9aa 100644 --- a/tornado/wsgi.py +++ b/tornado/wsgi.py @@ -181,6 +181,15 @@ class WSGIAdapter(object): that it is not possible to use `.AsyncHTTPClient`, or the `tornado.auth` or `tornado.websocket` modules. + In multithreaded WSGI servers on Python 3, it may be necessary to + permit `asyncio` to create event loops on any thread. Run the + following at startup (typically import time for WSGI + applications):: + + import asyncio + from tornado.platform.asyncio import AnyThreadEventLoopPolicy + asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy()) + .. versionadded:: 4.0 .. deprecated:: 5.1