Last active
June 30, 2016 17:14
-
-
Save tkling/9bd5c0d615d6da89710dbd25f3d949c1 to your computer and use it in GitHub Desktop.
Memory leak plan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
memory plan: | |
============ | |
- SSH to server | |
- add rbtrace (require: false) to gemfile, bundle install | |
- change passenger to only run 1 instance (via json config file) | |
- add this to before filter in applicaton_controller.rb: | |
require 'rbtrace' | |
- add this to application.rb: | |
require 'objspace' | |
ObjectSpace.trace_object_allocations_start | |
- start passenger (normal way - from deploy/scripts/application_start.sh) | |
- let server take some traffic | |
- take memory dump! | |
bundle exec rbtrace -p $PASSENGER_PID -e 'Thread.new{GC.start;require "objspace";io=File.open("./tmp/ruby-heap-#{DateTime.now.asctime}.dump", "w"); ObjectSpace.dump_all(output: io); io.close}' | |
- wait a bit and do the same thing a couple times | |
- comment out changes in application.rb, restart passenger again so that it's no longer in slow-mo (#trace_allocations_start slows things down) | |
- run dumps through analyzers like sam saffron's https://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby | |
- ???? hopefully that gives enough of a breadcrumb trail to figure out next steps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
π π π π π