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.

classification
Title: asyncio random crash with longtime run
Type: crash Stage:
Components: asyncio Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, iritkatriel, twbt4f, yselivanov
Priority: normal Keywords:

Created on 2021-05-31 07:58 by twbt4f, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
wait.py twbt4f, 2021-05-31 07:59
Messages (3)
msg394790 - (view) Author: 世界第一好吃 (twbt4f) Date: 2021-05-31 07:59
import asyncio
import timeit

num = 0


async def test():
    global num
    num += 1
    print(f"done task {num}")
    return f"task: {num}"


async def main():
    task = asyncio.create_task(test())

    # ko = await test()
    # print(await task, ko)


if __name__ == '__main__':
    number = 1000000
    while number:
        number -= 1
        asyncio.run(main())
    print("are you ok")
    # time_stage = timeit.timeit("asyncio.run(main())", globals=globals(), number=100000)
    # print(time_stage)
msg394794 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-31 08:19
What’s the output, what system are you using?
msg394796 - (view) Author: 世界第一好吃 (twbt4f) Date: 2021-05-31 08:57
I test it on
OS :Windows 10 Pro x64
Python: 3.9.5 x64

This Code if work will it will print "are you ok" and stop.
bug it print a random line like "done task 20897" ,stop print ,press Ctrl+C cannot break it.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88437
2021-05-31 13:02:50serhiy.storchakasettitle: asyncio random carsh with longtime run -> asyncio random crash with longtime run
2021-05-31 08:57:12twbt4fsetmessages: + msg394796
2021-05-31 08:19:34iritkatrielsetnosy: + iritkatriel
messages: + msg394794
2021-05-31 07:59:28twbt4fsetfiles: + wait.py

type: crash

components: + asyncio
versions: + Python 3.9
nosy: + asvetlov, yselivanov
title: asyncio random -> asyncio random carsh with longtime run
messages: + msg394790
2021-05-31 07:58:01twbt4fcreate