Forum: Ruby on Rails Memory leak from a base controller without sessions.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0e7d5331c8315f1cdba91506ed360195?d=identicon&s=25 (Guest)
on 2007-02-02 16:01
(Received via mailing list)
I've got a controller that I'm using as a check for monit to verify my
website is up and functioning. Right now it just is a simple index
page that just renders success. It seems that overnight, this
controller is leaking memory, to the point that after 8 hours, the
mongrel packs are restarted twice after reaching a 50mb size limit.
There is nothing else running on the site except this monitoring
action, as it's in development.

I've run this in both mongrel and webrick, and they both exhibit the
same behavior, a slow growth over time with no release of memory. The
same issue occurs if I render the string directly (render :text =>

Also, how can I turn off logging for this controller, as every 60
seconds, I get 4 hits in my log file letting me know that the
controller was hit. I stated in a previous post that logger.silence
wasn't working as expected for me, and now that I'm using an rhtml
file, I don't see where I would put the silence command. I tried it
around the render text when I was using that method, but it didn't
work either.

Any help is appreciated. Thanks.

class MonitController < ActionController::Base
  session :off
##   this is used by the monitoring scripts to see if the mongrel is
up and running
  def index

6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2007-02-02 20:41
(Received via mailing list)

On Feb 2, 2007, at 7:01 AM, wrote:

> same behavior, a slow growth over time with no release of memory. The
> end
>>> index.rhtml
> success

  A few things here.. Are you running the site in development mode? If
so be aware that rails leaks memory in development mode because of
all the reloading of classes and such. So if you are in dev mode then
this is to be expected, mongrel, fcgi or webrick will all exhibit the
same symptoms and leak memory. If you have to run in dev mode then
tell monit to restart the mongrels every 1 hour or so to keep them
from leaking.

  Also if you have monit set to restart mongrel if its memory goes
over 50Mb then be prepared for a lot of restarts. Rails apps can take
up anywhere from 40-100Mb per mongrel in my experience sometimes even
more. In my monit config I don't have mongrel restart until its
memory gets to 130Mb or more.


-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)
0e7d5331c8315f1cdba91506ed360195?d=identicon&s=25 (Guest)
on 2007-03-24 22:17
(Received via mailing list)
I was able to shut off logging for the monit controller by adding a
def logger end to the controller, and in so doing, it also seems to
have fixed my memory usage issues...
This topic is locked and can not be replied to.