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

tornado's call_later, add_callback, etc. prevent garbage collection of otherwise released objects #6353

Open
hendrikmakait opened this issue May 17, 2022 · 0 comments

Comments

@hendrikmakait
Copy link
Member

As mentioned in https://github.com/dask/distributed/pull/6246/files#r861616968, call_later and add_callback maintain references unless cancelled. We do not properly cancel callbacks in particular when closing Scheduler, Nanny or Worker instances. See below for an example:
scheduler_chain

(This reference chain was created with objgraph.find_backref_chain https://mg.pov.lt/objgraph/#memory-leak-example)

This in turn prevents garbage collection of otherwise released objects, which in turn prevents testing for proper garbage collection as requested in #6250. One possible solution has been sketched out in #6345, namely maintaining a registry of active callbacks, which can be used to cancel all active callbacks on close.

Instead of implementing this solution in the various places where it is needed, I'd suggest moving away from tornado while we are adjusting the callbacks and relying on asyncio.Tasks that we store in a background task registry introduced and cleaned on ServerNode or Server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant