{"action":"opened","issue":{"url":"https://api.github.com/repos/jazzband/django-debug-toolbar/issues/906","repository_url":"https://api.github.com/repos/jazzband/django-debug-toolbar","labels_url":"https://api.github.com/repos/jazzband/django-debug-toolbar/issues/906/labels{/name}","comments_url":"https://api.github.com/repos/jazzband/django-debug-toolbar/issues/906/comments","events_url":"https://api.github.com/repos/jazzband/django-debug-toolbar/issues/906/events","html_url":"https://github.com/jazzband/django-debug-toolbar/issues/906","id":199582789,"number":906,"title":"Object leak in logging panel when using threads","user":{"login":"willmcgugan","id":554369,"avatar_url":"https://avatars.githubusercontent.com/u/554369?v=3","gravatar_id":"","url":"https://api.github.com/users/willmcgugan","html_url":"https://github.com/willmcgugan","followers_url":"https://api.github.com/users/willmcgugan/followers","following_url":"https://api.github.com/users/willmcgugan/following{/other_user}","gists_url":"https://api.github.com/users/willmcgugan/gists{/gist_id}","starred_url":"https://api.github.com/users/willmcgugan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willmcgugan/subscriptions","organizations_url":"https://api.github.com/users/willmcgugan/orgs","repos_url":"https://api.github.com/users/willmcgugan/repos","events_url":"https://api.github.com/users/willmcgugan/events{/privacy}","received_events_url":"https://api.github.com/users/willmcgugan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-09T15:39:33Z","updated_at":"2017-01-09T15:39:33Z","closed_at":null,"body":"I recently tracked down a memory leak in our app, which turned out to be caused by the debug toolbar.\r\n\r\nOur 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.\r\n\r\nEssentially [this call](https://github.com/jazzband/django-debug-toolbar/blob/e7a9ed0c3de1c8635f7e8c83349cb77cef42489f/debug_toolbar/panels/logging.py#L83) only clears the main rendering thread, and not any sub-threads that may have been created in the view.\r\n\r\nI think you might want to make `_records` in `LoggingPanel` a weak key dictionary, if I have understood the code correctly..."}}
{"actor":{"display_login":"willmcgugan"}}