[issue45262] crash if asyncio is used before and after re-initialization if using python embedded in an application

Matthias Reichl report at bugs.python.org
Thu Oct 7 09:37:57 EDT 2021


Matthias Reichl <hias at horus.com> added the comment:

We were hitting the same issue in kodi, which uses embedded sub-interpreters to run python addons, after one of the addons was switched to asyncio.

The immediate cause of the assertion failure is a use-after-free issue from the running loop holder cache:

When the running loop holder is deallocated (which happens eg on interpreter shutdown) cached_running_holder holds a dangling pointer.

A subsequent call to get_running_loop() may then pick that up and boom.

While probably not a full fix for this issue I think it would be good to fix the use-after-free problem - there could be other code paths that lead to this situation. I've created a github pull request for that

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45262>
_______________________________________


More information about the Python-bugs-list mailing list