]> git.ipfire.org Git - thirdparty/tornado.git/commit
tcpserver: Fix multiprocess modes 2220/head
authorBen Darnell <ben@bendarnell.com>
Tue, 19 Dec 2017 03:56:40 +0000 (22:56 -0500)
committerBen Darnell <ben@bendarnell.com>
Tue, 19 Dec 2017 14:10:09 +0000 (09:10 -0500)
commitbf1b21ab4289d45c1292c6d73cafe4b5a1320b2b
tree05942ae5963d2d0c772d7302714ecfc8b2aa0338
parent268aaf689595cef80c5cef762f28ee91720f508f
tcpserver: Fix multiprocess modes

Two recent changes broke Tornado's multiprocess modes by initializing
the event loop before the fork in typical patterns.
- The removal of `io_loop` arguments moved a call to
  IOLoop.current() earlier in TCPServer's constructor.
- The change to `asyncio.Future` initialized the asyncio event loop at
  import time.

Move the call in TCPServer earlier (and audit the rest of that change
to make sure this didn't happen anywhere else) and replace
`gen.moment` and `gen._null_future` with dummy objects that do not
involve the asyncio event loop.
tornado/gen.py
tornado/queues.py
tornado/tcpserver.py
tornado/test/tcpserver_test.py