gen: Hold strong references to all asyncio.Tasks
Per the warning in the asyncio documentation, we need to hold a strong reference to all asyncio Tasks to prevent premature GC. Following discussions in cpython (https://github.com/python/cpython/issues/91887), we hold these references on the IOLoop instance to ensure that they are strongly held but do not cause leaks if the event loop itself is discarded. This is expected to fix all of the various "task was destroyed but it is pending" warnings that have been reported. The IOLoop._pending_tasks set is expected to become obsolete if corresponding changes are made to asyncio in Python 3.13. Fixes #3209 Fixes #3047 Fixes #2763 Some issues involve this warning as their most visible symptom, but have an underlying cause that should still be addressed. Updates #2914 Updates #2356
Showing
想要评论请 注册 或 登录