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
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. For reliable “fire-and-forget” background tasks, gather them in a collection:
bdraco
changed the title
These are at risk of websocket ping tasks being garbage collected before they finish.
These are at risk of websocket ping tasks being garbage collected before they finish
Aug 6, 2024
bdraco
changed the title
These are at risk of websocket ping tasks being garbage collected before they finish
Risk of websocket ping tasks being garbage collected before they finish
Aug 7, 2024
The event loop only keeps weak references to tasks, we need to
hold a strong reference to ensure that the ping task is not
prematurely garbage collected.
https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
In almost all cases the ping can be done synchronously if
the task is created eagerly which avoids scheduling the ping
task on the event loop.
fixes#8614
This is an existing problem to be solved in a future PR
https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
Originally posted by @bdraco in #8608 (comment)
The text was updated successfully, but these errors were encountered: