Andrew Svetlov <andrew.svet...@gmail.com> added the comment:
Thanks for the report! I see 3 ways to fix the bug: 1. Guard _all_tasks with threading.Lock. It hurts performance significantly. 2. Retry list(_all_tasks) call in a loop if RuntimeError was raised. A chance of collision is very low, the strategy is good enough 3. Change _all_tasks from weak set of tasks to WeakDict[AbstractEventLoop, WeakSet[Task]]. This realization eliminates the collision it is a little complicated. Plus loop should be hashable now (perhaps ok but I'm not sure if all third-party loops support it). Thus I'm inclining to bullet 2. THoughts? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36607> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com