Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GC of coroutines/events leaks state between loops #101

Open
maxfischer2781 opened this issue Dec 11, 2020 · 0 comments
Open

GC of coroutines/events leaks state between loops #101

maxfischer2781 opened this issue Dec 11, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@maxfischer2781
Copy link
Contributor

Description of the bug
When a loop ends and leaves behind objects, collecting them after a new loop starts transfers state between the two loops. This is because usim objects interact with the "current" event loop; delayed cleanup means the current loop is the wrong one.

How To Reproduce
No repro yet. Encountered this in lapis when cleaning an async generator is cleaned up.

Expected behavior
Objects should not leak. We might have to register objects and explicitly clean them up. Keep in mind that not registering was an explicit design decision to avoid overhead; if needed, restrict it to objects that need it.

  • Consider sys.set_asyncgen_hooks to link async generators (the most likely culprit) to the event loop.
  • Consider gc.collect whenever a loop finishes and/or starts.
@maxfischer2781 maxfischer2781 added the bug Something isn't working label Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant