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 kmaork
Recipients Zhibin Dong, asvetlov, kmaork, yselivanov
Date 2020-02-20.20:20:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582230031.07.0.406418708052.issue39622@roundup.psfhosted.org>
In-reply-to
Content
I wrote a small script that checks the behavior of asyncio.sleep when called with small amounts of time (starting from 0). For each amount I checked 500 times whether SleepTest has stopped when interrupted with SIGINT. Below are the results:

SLEEP TIME  SIGINT FAILURE PERCENT
0           26.6%
1e-06       9.8%
2e-06       11.8%
3e-06       11.2%
4e-06       9.6%
5e-06       13.8%
6e-06       5.6%
7e-06       2.6%
8e-06       1.4%
9e-06       1.6%
1e-05       2.2%
1.1e-05     2.2%
1.2e-05     2.0%
1.3e-05     1.8%
1.4e-05     0.8%

It is worth mentioning that the failure amount increased when my CPU was busier. Maybe it is because of false positives in my script (although I think I used relatively generous timeouts when waiting for the ioloop to start running and for the process to die after a SIGINT) and maybe it is because of the nature of the bug in asyncio. I didn't put a lot of effort into distinguishing between the two, as increasing the timeouts also made my CPU less busy.

Anyway, there is definitely a weird behavior here, and I still think there is a specific piece of code in asyncio that's causing it. Maybe I'll look at the code a bit, or try to think of other ways to approach this.
History
Date User Action Args
2020-02-20 20:20:31kmaorksetrecipients: + kmaork, asvetlov, yselivanov, Zhibin Dong
2020-02-20 20:20:31kmaorksetmessageid: <1582230031.07.0.406418708052.issue39622@roundup.psfhosted.org>
2020-02-20 20:20:31kmaorklinkissue39622 messages
2020-02-20 20:20:30kmaorkcreate