twisteroid ambassador <twisteroid.ambassa...@gmail.com> added the comment:

I have finally managed to reproduce this one reliably. The issue happens when 
i) async generators are not finalized immediately and must be garbage collected 
in the future, and ii) the garbage collector happens to run in a different 
thread than the one running the event loop. (Obviously, if there are more than 
one Python threads, eventually gc will run in those other threads, causing 
problems.)

I have attached a script reproducing the problem. I tried several ways of using 
async generators (the use_agen_*() coroutines), and the only way to make them 
not finalize immediately is use_agen_anext_separate_tasks(), which is the 
pattern used in my Happy Eyeballs library.

----------
Added file: https://bugs.python.org/file47838/asyncgen_test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34769>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to