Author vstinner
Recipients asvetlov, gvanrossum, vstinner, yselivanov
Date 2018-07-12.10:20:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531390853.07.0.56676864532.issue34037@psf.upfronthosting.co.za>
In-reply-to
Content
It's easy to reproduce the issue on Linux:

diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 11cd950df1..df4c2b9849 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -359,7 +359,7 @@ class EventLoopTestsMixin:
             called = True
 
         def run():
-            time.sleep(0.05)
+            time.sleep(1.0)
 
         f2 = self.loop.run_in_executor(None, run)
         f2.cancel()


The problem is that BaseEventLoop.close() shutdowns its default executor  without waiting:

    def close(self):
        ...
        executor = self._default_executor
        if executor is not None:
            self._default_executor = None
            executor.shutdown(wait=True)

I fixed a similar issue in socketserver:

* bpo-31233: for socketserver.ThreadingMixIn
* bpo-31151: for socketserver.ForkingMixIn 
* bpo-33540: add block_on_close attr to socketserver

I suggest to wait by default, but maybe also add a block_on_close attribute to BaseEventLoop (default: False) just for backward compatibility.

What do you think Yury, Andrew, and Guido?
History
Date User Action Args
2018-07-12 10:20:53vstinnersetrecipients: + vstinner, gvanrossum, asvetlov, yselivanov
2018-07-12 10:20:53vstinnersetmessageid: <1531390853.07.0.56676864532.issue34037@psf.upfronthosting.co.za>
2018-07-12 10:20:53vstinnerlinkissue34037 messages
2018-07-12 10:20:52vstinnercreate