STINNER Victor <vstin...@python.org> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to