I have production code that heavily used the asyncio.semaphore module, which is supposed to have a deadlock problem. I already found some solution on how to connect to running python code with unix signal, debug with ipdb.set_trace()and list all tasks in the event loop with asyncio.Task.all_tasks(). Can I additionally check the stack stack for each task or view every line of the coroutine that is currently waiting for futures on ipdb?
ipdb.set_trace()
asyncio.Task.all_tasks()
ipdb
As the OP notes, further checks can be obtained using
[*map(asyncio.Task.print_stack, asyncio.Task.all_tasks())]
(OP is definitely free self-answer .)