You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #17801, but in another location. An asyncio task is created using asyncio.create_task, but the reference to the task isn't kept. Opening a separate github issue for this since the previous one is closed.
Important Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. https://docs.python.org/3/library/asyncio-task.html#creating-tasks
Wouldn't this be an issue here in Workflow? The task returned by asyncio.create_task is not being used.
Yes, there is indeed an issue in the Workflow where the task created by asyncio.create_task is not being used, which can lead to the task being garbage collected before it completes. This is a known problem that can cause undefined behavior and errors like 'Task exception was never retrieved'. To address this, you should store a reference to the task to ensure it is not garbage collected prematurely. Alternatively, you can use await directly if immediate execution is appropriate, or use TaskGroups in Python 3.11+ to manage task lifetimes automatically [1].
Bug Description
Similar to #17801, but in another location. An asyncio task is created using
asyncio.create_task
, but the reference to the task isn't kept. Opening a separate github issue for this since the previous one is closed.Wouldn't this be an issue here in Workflow? The task returned by
asyncio.create_task
is not being used.Originally posted by @josephgrigg in #17801
Version
0.12.23.post2
Steps to Reproduce
Chance of this happening randomly when garbage collection occurs while the task is still running.
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: