Greetings mem-leakers
Greetings,
I've recently deployed an app that is having some serious memory
consumption issue. Dropping mongrels quite frequently when the
threshold is met.
Initially, we chalked this problem up to RMagick (I know, I know, but we
needed watermarking).
If RMagick is not the source of leaks currently then this won't help,
but I just do the following:
`convert -resize 480x360 #{temp_file_path} #{file_path}`
My image uploading is low volume, so this works fine for me. I think
it would work well even for much higher volumes, but I haven't
benchmarked the difference between a command line invocation and
RMagick. It's not likely to leak though.
If you track down the problem please post it.
I don't have any answers yet, a few clues, but have some tools to suggest:
re: clues. this article looks promising:
http://blog.pluron.com/2008/01/ruby-on-rails-i.html
As for tools, I'm trying out Evan Weaver's bleak-house:
http://blog.evanweaver.com/files/doc/fauna/bleak_house/files/README.html
as it patches ruby, you'll want to use this on your staging server (Evan says he uses the patched ruby in production)
this is the output from Bleak:
./homestars/shared/log $ bleak /tmp/bleak.3242.0.dump
632837 total objects
Final heap size 632837 filled, 732169 free
Displaying top 20 most common line/class pairs
510101 __null__:__null__:__node__
29450 __null__:__null__:String
5511 /usr/local/lib/ruby/gems/1.8/gems/memcached-0.8.1/lib/memcached/memcached.rb:295:String
4692 (eval):1:__node__
3442 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:836:String
3442 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:836:ActionController::Routing::DividerSegment
2084 __null__:__null__:Regexp
1902 /usr/local/lib/ruby/gems/1.8/specifications/tzinfo-0.3.7.gemspec:12:String
1686 generated_code_(/var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:388):1:__node__
1491 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:834:String
1491 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:834:ActionController::Routing::StaticSegment
1287 /var/www/apps/homestars/releases/20080407140541/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/deprecation.rb:92:__node__
1106 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:827:ActionController::Routing::DynamicSegment
1056 /usr/local/lib/ruby/gems/1.8/specifications/rmagick-2.2.2.gemspec:13:String
1051 /usr/local/lib/ruby/1.8/yaml.rb:133:String
976 /var/www/apps/homestars/releases/20080407140541/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/module/aliasing.rb:28:__node__
938 /var/www/apps/homestars/releases/20080407140541/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/module/aliasing.rb:29:__node__
891 __null__:__null__:Class
845 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:945:ActionController::Routing::Route
845 /var/www/apps/homestars/releases/20080407140541/vendor/rails/actionpack/lib/action_controller/routing.rb:865:Hash
(the above is from a single run of hitting a single url for 15 minutes. working out a test approach presently)
The above is after a 30 minute run - showing 5511 objects lost in memached (funny enough also written by Evan - I've asked him about the leak). The __ leaks are supposedly internal to ruby - boy, that's a load of lost objects -
other than tzinfo (which I've heard is a culprit), it seems to me that routing is generating a load. Anybody have any info on routing and leaks?
I'm at a bit of a loss when digging info ruby leaks/garbage collection. If anybody has a good ref I'd appreciate it.
rails 1.2.6
ruby 1.8.6 (2008-03-03 patchlevel 901) [i686-linux]
thanx.
Jodi