This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author njs
Recipients achimnol, asvetlov, njs, terry.reedy, yselivanov, zkonge
Date 2020-07-19.10:04:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Huh, this is very weird. I can confirm that the async generator objects aren't cleaned up until loop shutdown on asyncio.

On the trio main branch, we don't yet use the `set_asyncgen_hooks` mechanism, and the async generator objects are cleaned up immediately.

However, if I check out this PR that will add it:

...then we see the same bug happening with Trio: all the async generators are kept around until loop shutdown.

Also, it doesn't seem to be a circular references issue – if I explicitly call `gc.collect()`, then the asyncgen destructors are still *not* called; only shutting down the loop does it.

This doesn't make any sense, because asyncio/trio only keep weak references to the async generator objects, so they should still be freed.

So maybe the `set_asyncgen_hooks` code introduces a reference leak on async generator objects, or something?
Date User Action Args
2020-07-19 10:04:50njssetrecipients: + njs, terry.reedy, asvetlov, yselivanov, achimnol, zkonge
2020-07-19 10:04:50njssetmessageid: <>
2020-07-19 10:04:50njslinkissue41229 messages
2020-07-19 10:04:50njscreate