Skip to content

Object leak in logging panel when using threads #906

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

Closed
willmcgugan opened this issue Jan 9, 2017 · 1 comment · Fixed by #1732
Closed

Object leak in logging panel when using threads #906

willmcgugan opened this issue Jan 9, 2017 · 1 comment · Fixed by #1732

Comments

@willmcgugan
Copy link

willmcgugan commented Jan 9, 2017

I recently tracked down a memory leak in our app, which turned out to be caused by the debug toolbar.

Our Django app launches and destroys a thread in the context of a view (to talk to a websocket server). When that thread writes to logs, debug_toolbar creates a reference to the Thread instance which it never clears. Disabling DEBUG makes no difference.

Essentially this call only clears the view thread, and not any sub-threads that may have been created in the view.

I think you might want to make _records in LoggingPanel a weak key dictionary, if I have understood the code correctly...

@auvipy
Copy link
Contributor

auvipy commented Oct 25, 2021

so you have any implementation plan with tests?

vbaltrusaitis-reef added a commit to vbaltrusaitis-reef/cookiecutter-rt-django that referenced this issue Aug 12, 2022
debug_toolbar version 3.2.1 causes a memory leak in one of our projects.
This leak happens even if the toolbar is never used, never added to
urlpatterns and DEBUG is set to False. The import is enough.

Newer toolbar versions don't cause this particular problem,
but I'm still making the import condition just in case.

See:
https://github.com/vbaltrusaitis-reef/memleak-demo
django-commons/django-debug-toolbar#906
matthiask added a commit to matthiask/django-debug-toolbar that referenced this issue Jan 20, 2023
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

Successfully merging a pull request may close this issue.

2 participants