Bug report
A task that is running is shown with a single frame instead of its call stack.
import asyncio, os, sys
async def coro1():
return 1
async def c():
if sys.argv[1] == "spin":
while True:
await coro1()
await asyncio.sleep(100)
async def b(): await c()
async def a(): await b()
async def main():
print(os.getpid(), flush=True)
await a()
asyncio.run(main())
Sleep (expected):
./python.exe repro.py sleep
➜ cpython git:(main) ✗ sudo ./python.exe -m asyncio ps 89369
Password:
tid task id task name coroutine stack awaiter chain awaiter name awaiter id
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3924274 0x1039d4d70 Task-1 sleep -> c -> b -> a -> main 0x0
Spin (actual):
./python.exe repro.py spin
➜ cpython git:(main) ✗ sudo ./python.exe -m asyncio ps 89667
tid task id task name coroutine stack awaiter chain awaiter name awaiter id
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3925594 0x105370d70 Task-1 main 0x0
Proposed fix: For a running task, read the frames from the thread stack, as get_async_stack_trace() already do
I have a fix ready for that
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
A task that is running is shown with a single frame instead of its call stack.
Sleep (expected):
Spin (actual):
Proposed fix: For a running task, read the frames from the thread stack, as get_async_stack_trace() already do
I have a fix ready for that
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs