railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.9k stars 2.26k forks source link

Memory leak #2672

Open rotem443 opened 8 years ago

rotem443 commented 8 years ago

I'm using rails-admin for a while, in the last couple of weeks i started to suffer from a memory leak. I use Skylight (Code profiler) and I saw that rails_admin require allot of memory. Then I opened up heroku metrics before and affter use on rails_admin, he is the results: http://prntscr.com/bvcvkd

The memory usage raises from 160MB to 317MB. The graph is becoming stable only after i stopped using the admin panel

jipiboily commented 8 years ago

I'm seeing similar behaviour here. It's been a long time in my case. I'm seeing R14 most of the time after visiting the admin. If I don't visit it, I am usually under or around 350MB.

galharth commented 8 years ago

+1 Same here..

sebfie commented 8 years ago

I suspect the same for me!

thedanielhanke commented 8 years ago

next to the pretty graphs, are there further details you can provide? any suspects?

patleb commented 7 years ago

Same here, on my side, it happens on a CSV export where it needs at least 300MB of RAM to generate the file (which is around 20MB). I didn't have the time to investigate further, so I'm using Monit right now to restart nginx when the memory goes too high.

nancyhuynh commented 7 years ago

I also encountered significant memory increases using rails admin on our site (the uptick in our heroku memory graphs looks very similar to the one posted by @rotem443).

The memory usage is exacerbated since we use puma with 3 workers, so we see the increase across all workers (recently decreased to 2 workers to alleviate our R14 warnings in heroku).

From locally testing a few times, it seems that loading the admin index/dashboard for the first time (after loading our site's home page) increases the memory of a single rails process by 20-60MB. Our dashboard has about 40 models.

With each additional worker, I see a similar uptick. Here are a couple of samples:

==========

Single rails process:

206MB - startup and loading homepage 247MB - load admin index (increase 39MB) 252MB - load admin index (increase 5MB) 263MB - load admin index (increase 11MB) 268MB - load admin index (increase 5MB) 268MB - load admin index 5 times sequentially (no increase) 272MB - load admin index (increase 5MB) 272MB - load admin index (no increase) 282MB - load admin index 10 times sequentially (increase 10MB)

==========

puma 2 workers, 1 thread each

190MB - start up 361MB - load home page (increase due to activating worker A) 536MB - load home page (increase due to activating worker B) 566MB - load admin index (increase 30MB for worker “A”) 579MB - load admin index (increase 13MB for worker “A”) 591MB - load admin index (increase 12MB for worker “A”) 658MB - load admin index (5 times sequentially, increase 67MB for worker “B” - first time worker B received admin request) 668MB - load admin index (5 times sequentially, increase 10MB across A and B)

==========

puma, 2 workers, 1 thread:

545MB - after booting and loading homepage multiple times so that both workers have been activated and have received requests 563MB - load admin index (increase 18MB for worker A) 590MB - load admin index (increase 27MB for worker A) 621MB - load admin index (increase 31MB for worker A) 617MB - load admin index (decrease 4MB for worker A) 621MB - load admin index (increase 4MB for worker A)

thedanielhanke commented 7 years ago

I also had this using puma. it dont have logs, but i can pretty well remember tha i was swapping a lot on a 4 gig machine using puma, 4 workers, mri.

moving to passenger standalone (and therefore also with system-nginx), i only have a overall consumtion of 1.7GB, and the app was growing meanwhile.

just in case it helps. cheers

Fattouh92 commented 7 years ago

using puma and rails 5.0.1 had a problem when tried to search for admin dashboard; memory went to 6.5 gb from 2 gb

volkerholloh commented 7 years ago

+1 using railsAdmin 1.1.1

tscung commented 7 years ago

I am also facing them same problem. The memory raise very fast and eventually puma crashed.

sedubois commented 5 years ago

Was this using pundit? Maybe this helps (it did for me)? https://github.com/sferik/rails_admin/issues/2575#issuecomment-270688893

kaiomagalhaes commented 3 years ago

I'm facing this issue as well, using the latest version, very often when I try to edit a record In Heroku it throws a memory issue.