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

Elasticsearch debug toolbar causes memory leak #7

Open
igo opened this issue Dec 8, 2016 · 5 comments
Open

Elasticsearch debug toolbar causes memory leak #7

igo opened this issue Dec 8, 2016 · 5 comments

Comments

@igo
Copy link

igo commented Dec 8, 2016

Using Elasticsearch debug toolbar causes memory leak and thus crash when elasticsearch is extensively used. Not sure if this is general debug-toolbar problem or specific for elasticsearch-debug-toolbar but I did not notice this problem with other panels.
Seems like after each elastic query an elastic_panel.panel.ElasticQueryInfo instance is created which resides in memory forever. I used http://mg.pov.lt/objgraph/objgraph.html#objgraph.show_growth to find out what objects are kept in memory. During tests I ended up with more than 100.000 of ElasticQueryInfo instances.

@Benoss
Copy link
Owner

Benoss commented Jan 17, 2017

I am not surprised, Django itself as leaks in DEBUG mode because it is keeping some references. But in this case those objects should be cleared when collector.clear_collection() is called. And this is done for every request. This is probably a django debug toolbar issue.

@igo
Copy link
Author

igo commented Jan 17, 2017

It leaks even with DEBUG=False. Question is why is this leak relevant only for django-elasticsearch-debug-toolbar and not for every debug-toolbar plugin?

@Benoss
Copy link
Owner

Benoss commented Jan 18, 2017

I'will try to investigate, but if you have any idea do not hesitate :)

@ggaughan
Copy link

ggaughan commented Oct 4, 2017

I think the patched_log_request_success keeps a history for every thread (DEBUG or not) (invoked by Connections), but suspect that the collector.clear_collection() only runs for the thread in charge of the panel (and only when DEBUG), leaving the other thread histories to leak.

@Benoss
Copy link
Owner

Benoss commented Oct 7, 2017

Good catch,
The collector is part of core debug toolbar, This plugin should not be the only one leaking :(

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

3 participants