What does an "Executing <Handle <TaskWakeupMethWrapper..." warning in python asyncio mean

Executing <Handle <TaskWakeupMethWrapper object at 0x7fc3435141f8>(<Future finis...ection.py:260>) created at /media/stuff/stuff/projects/dare/dcds/dcds/common/connection.py:221> took 1.723 seconds

Main part of this warning is took 1.723 seconds: warning says that some coroutine (or task) has freezed your event loop for 1.7 seconds, which is not normal situation (if you don't see why, please read answer here or better here).

As you noted asyncio tracks this problem only when debug mode is on.

Task was destroyed but it is pending!

This warning you'll get regardless of debug mode, it means that at the moment you call loop.close() you still have running tasks. It's again not normal situation (read here to see why).


It's hard to say more without reproducible code snippet.

If you store task in WeakValueDictionary it can be problem, yes. You should properly cancel all tasks (or await them to be finished) before you close event loop.