Author vstinner
Recipients vstinner
Date 2019-10-23.15:01:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571842882.18.0.409580310759.issue38564@roundup.psfhosted.org>
In-reply-to
Content
test_run_coroutine_threadsafe_with_timeout() has a race condition. It relies on "await asyncio.sleep(0.05)" synchronization primitive. That's not reliable.

    async def add(self, a, b, fail=False, cancel=False):
        """Wait 0.05 second and return a + b."""
        await asyncio.sleep(0.05)
        if fail:
            raise RuntimeError("Fail!")
        if cancel:
            asyncio.current_task(self.loop).cancel()
            await asyncio.sleep(0)
        return a + b
History
Date User Action Args
2019-10-23 15:01:22vstinnersetrecipients: + vstinner
2019-10-23 15:01:22vstinnersetmessageid: <1571842882.18.0.409580310759.issue38564@roundup.psfhosted.org>
2019-10-23 15:01:22vstinnerlinkissue38564 messages
2019-10-23 15:01:22vstinnercreate