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 db3l
Recipients Ben.Darnell, Burak Yiğit Kaya, Jonathan Slenders, PeterL777, Rustam S., Segev Finer, asvetlov, cjrh, cmeyer, db3l, miss-islington, steve.dower, yselivanov
Date 2020-09-02.03:41:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599018074.57.0.651352994178.issue39010@roundup.psfhosted.org>
In-reply-to
Content
I'm guessing the warning appears odd as we're seeing a thread shutdown data race.  The message is produced by threading_cleanup in support/threading_helper.py, and it appears that between the first and second lines one of the initially dangling threads goes away, so the only one left to be enumerated is the main thread, at which point the function is simply listing all threads currently alive.  But by that point it's just the main thread remaining.

I notice in the test that you have a comment about needing to wait for f to complete or you get a warning about thread not shutting down cleanly.  Was that a similar warning?  The run_until_complete(f) line seems to have no effect on the buildbot.

If I added a small sleep at the end of the test the warnings go away on the buildbot.  The buildbot is a fairly fast machine, so perhaps the test just needs to wait somehow for the event loop to fully shut down or something.

The most direct cause of the warnings seems to be the self.loop.close() call - if I just comment that out the test runs warning-free without any extra delay needed.

I don't know much about asyncio tests, but it would appear the close call in the test defeats some of the logic in the close_loop teardown code that runs under TestCase (in utils.py), which under Windows is just a call to run_until_complete(loop.shutdown_default_executor()).  If I add that same call to the test prior to the close it also passes cleanly.

So if closing the loop in the test itself is crucial, I'd suggest including the extra run_until_complete call.  If closing isn't crucial to the test, simply removing it seems to address the issue.  I'm not sure if its removal then has any implications for the extra run_until_complete(f) call in the test, as I can't see any impact from that on the buildbot.
History
Date User Action Args
2020-09-02 03:41:14db3lsetrecipients: + db3l, asvetlov, cjrh, Ben.Darnell, yselivanov, steve.dower, cmeyer, Segev Finer, miss-islington, PeterL777, Jonathan Slenders, Rustam S., Burak Yiğit Kaya
2020-09-02 03:41:14db3lsetmessageid: <1599018074.57.0.651352994178.issue39010@roundup.psfhosted.org>
2020-09-02 03:41:14db3llinkissue39010 messages
2020-09-02 03:41:13db3lcreate