From a97ec9569b1995d8aa3da0a7f499510bffc006a3 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 22 May 2016 00:35:44 -0400 Subject: [PATCH] Skip a flaky test on AsyncIOLoop --- tornado/platform/asyncio.py | 2 ++ tornado/test/ioloop_test.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index e9a062cf1..6b374f29e 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -141,6 +141,8 @@ class BaseAsyncIOLoop(IOLoop): def add_callback(self, callback, *args, **kwargs): if self.closing: + # TODO: this is racy; we need a lock to ensure that the + # loop isn't closed during call_soon_threadsafe. raise RuntimeError("IOLoop is closing") self.asyncio_loop.call_soon_threadsafe( self._run_callback, diff --git a/tornado/test/ioloop_test.py b/tornado/test/ioloop_test.py index 8eda7acb4..8570e73f0 100644 --- a/tornado/test/ioloop_test.py +++ b/tornado/test/ioloop_test.py @@ -140,6 +140,8 @@ class TestIOLoop(AsyncTestCase): def test_add_callback_while_closing(self): # Issue #635: add_callback() should raise a clean exception # if called while another thread is closing the IOLoop. + if IOLoop.configured_class().__name__.endswith('AsyncIOLoop'): + raise unittest.SkipTest("AsyncIOMainLoop shutdown not thread safe") closing = threading.Event() def target(): -- 2.47.2