Google Groups Home
Help | Sign in
Extreme memory leak
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Radamanthus Batnag  
View profile
 More options May 13, 7:33 am
From: Radamanthus Batnag <radamant...@gmail.com>
Date: Tue, 13 May 2008 04:33:55 -0700 (PDT)
Local: Tues, May 13 2008 7:33 am
Subject: Extreme memory leak
Hi folks,

I have a production setup that isn't live yet (<500 visitors per day)
but the mongrels are already misbehaving.
monit has been configured to restart mongrels that are consuming more
than 170MB. What I observe is that the mongrels quickly hit this
limit, typically within 10-20 minutes of starting up. I relaxed the
memory cap for one mongrel and set it to 500MB but the result is still
the same - it still hits the monit memory limit almost as fast as the
other mongrels.

log rotation is in place and the logs are being truncated when they
hit more than 10MB.
gettext is being used heavily in almost all pages.
page caching and page fragment caching is used almost everywhere it
can be used.

On my local development machine, I find that I can easily hit 200MB
with less than 50 clicks. I typically keep my mongrel running all the
time during development. As of today my dev mongrel has been up since
yesterday and I just found out that it is now at 800MB, with just me
poking at it over the last 36 hours or so.

I (well, me and my teammates) are looking at the following steps to
see what's going on:
1. run bleak_house to see where the leaks are coming from
2. run on JRuby and see if we'll get the same memory leak patterns. If
we do then definitely it's our code that's suspect here. If we don't
then maybe it's with one of the gems or libraries we're using.

I am also hoping that these too will help:
3. install the latest ruby 1.8.6 from source (patch level 114?)
4. install the latest postgres gem (0.7.9?)

I'd very much appreciate any pointers on other possible actions to
take.

Thanks!
rad

Here are more details on the production server:
Dual Intel Xeon 2GHz
4GB RAM
64-bit CentOS 5.1
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
rubygems 1.1.1

gems:
actionmailer (2.0.2, 1.3.6, 1.3.3)
actionpack (2.0.2, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.0.2, 1.15.6, 1.15.3)
activeresource (2.0.2)
activesupport (2.0.2, 1.4.4, 1.4.2)
ar_mailer (1.3.1)
ar_mailer_generator (1.0.0)
bleak_house (4.0)
BlueCloth (1.0.0)
capistrano (2.2.0)
cgi_multipart_eof_fix (2.5.0)
columnize (0.1)
daemons (1.0.10)
eventmachine (0.10.0)
fastthread (1.0.1)
gem_plugin (0.2.3)
gettext (1.10.0)
highline (1.4.0)
hoe (1.5.1)
hpricot (0.6)
htmlentities (4.0.0)
linecache (0.42)
mocha (0.5.6)
mongrel (1.1.4)
mongrel_cluster (1.0.5)
needle (1.3.0)
net-sftp (1.1.1)
net-ssh (1.1.2)
production_log_analyzer (1.5.0)
rails (2.0.2, 1.2.6, 1.2.3)
rails_analyzer_tools (1.4.0)
railsmachine (1.0.0)
rake (0.8.1)
RedCloth (3.0.4)
rmagick (2.3.0)
ruby-debug (0.10.1)
ruby-debug-base (0.10.1)
ruby-postgres (0.7.1.2006.04.06)
ruby-prof (0.6.0)
rubyforge (0.4.5)
RubyInline (3.6.7)
rubypants (0.2.0)
swiftiply (0.6.1.1)
SyslogLogger (1.4.0)
ZenTest (3.9.2)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark John Buenconsejo  
View profile
 More options May 13, 7:48 am
From: "Mark John Buenconsejo" <markjo...@gmail.com>
Date: Tue, 13 May 2008 19:48:19 +0800
Local: Tues, May 13 2008 7:48 am
Subject: Re: [PhRUG:1554] Extreme memory leak
Hi, we are also struggling with the memory consumption of the mongrel
nodes. Ours go about 200MB to 300MB a piece, and have monit restart
them if they go beyond 300MB.

However, we made some testing even with a base Rails installation, and
it looks like Rails is not at fault with the memory leaks. We also
tried to figure out what went wrong, and until now, it's an on-going
investigation. It's hard to pin-point where the leak is coming from,
since it's a really big app.

Based on our investigation one particular common mistake that leads to
leaks is when we manipulate instantiated objects within the request
(controller action) and pass them over to a global method (class
method). Like for example, keeping a global list of some object that
is appended in the request. The mistake doesn't have to be this
obvious, but can be in a similar situation where locally instantiated
objects are being pointed to in the global context. You might want to
keep this in mind when you look for that leak.

Hope that helps!

Mark

On Tue, May 13, 2008 at 7:33 PM, Radamanthus Batnag

--
------------------------------------
Mark John S. Buenconsejo
http://www.simpleteq.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Beckwith  
View profile
 More options May 13, 9:49 am
From: "David Beckwith" <dbitsoluti...@gmail.com>
Date: Tue, 13 May 2008 06:49:44 -0700
Local: Tues, May 13 2008 9:49 am
Subject: Re: [PhRUG:1554] Extreme memory leak

If possible step backwards in time through your SVN commits in a
divide-and-conquer manner (halve the version number each time).  Deploy,
run, check monit, deploy, run, check monit, until you find the SVN version
that causes the memory leak.  I heard Rmagick leaks, and you have that
listed up there.

As Mark mentioned the base installation presumable has no memory leak.

David :)

On Tue, May 13, 2008 at 4:33 AM, Radamanthus Batnag <radamant...@gmail.com>
wrote:

--
SMS/Text: +63 905 220 2207
Skype: dbit_solutions

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Radamanthus Batnag  
View profile
 More options May 14, 12:48 am
From: "Radamanthus Batnag" <radamant...@gmail.com>
Date: Wed, 14 May 2008 12:48:44 +0800
Local: Wed, May 14 2008 12:48 am
Subject: Re: [PhRUG:1556] Re: Extreme memory leak
Thanks for the quick reply guys.

It's a good thing we have tagged releases, so I can go back to SVN one
release at a time. I'll look for the code patterns Mark mentioned; it
seems to me that our permissions code which is called almost
everywhere use that pattern.

rad


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
j4s0n  
View profile
 More options May 14, 1:43 am
From: j4s0n <jason.e.tor...@gmail.com>
Date: Tue, 13 May 2008 22:43:04 -0700 (PDT)
Local: Wed, May 14 2008 1:43 am
Subject: Re: Extreme memory leak
i'm thinking that it's ruby GC acting weird given that the server has
4GB of memory. The larger the memory is, the longer it takes for the
ruby GC to pass on it. It was said that don't spoil your  mongrels too
much. But then, I maybe wrong because you've mentioned that it's
acting the same on your dev machine. Just some thoughts lang. :)

On May 14, 12:48 pm, "Radamanthus Batnag" <radamant...@gmail.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Beckwith  
View profile
 More options May 14, 3:56 am
From: "David Beckwith" <dbitsoluti...@gmail.com>
Date: Wed, 14 May 2008 00:56:22 -0700
Local: Wed, May 14 2008 3:56 am
Subject: Re: [PhRUG:1560] Re: Extreme memory leak

btw, make sure you don't have

require 'ruby-dbug'
Debugger.start in there

http://codehappy.wordpress.com/2007/01/17/tracking-a-memory-leak-in-r...

--
SMS/Text: +63 905 220 2207
Skype: dbit_solutions

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google