Vasfed / heap_dump

ruby gem for dumping heap references
MIT License
91 stars 13 forks source link

HeapDump.dump crashes #4

Closed chadrem closed 11 years ago

chadrem commented 11 years ago

When I try to run HeapDump.dump in a Rails console (irb), I get the following exception:

1.9.3p194 :001 > HeapDump.dump Dump should go to dump.json machine context global_List starting objspace walk RangeError: integer 70282190736600 too big to convert to int' from /Users/chad/.rvm/gems/ruby-1.9.3-p194@sfc2/gems/heap_dump-0.0.28/lib/heap_dump.rb:10:indump_ext' from /Users/chad/.rvm/gems/ruby-1.9.3-p194@sfc2/gems/heap_dump-0.0.28/lib/heap_dump.rb:10:in dump' from (irb):1 from /Users/chad/.rvm/gems/ruby-1.9.3-p194@sfc2/gems/railties-3.2.8/lib/rails/commands/console.rb:47:instart' from /Users/chad/.rvm/gems/ruby-1.9.3-p194@sfc2/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in start' from /Users/chad/.rvm/gems/ruby-1.9.3-p194@sfc2/gems/railties-3.2.8/lib/rails/commands.rb:41:in<top (required)>' from script/rails:6:in require' from script/rails:6:in

'

Vasfed commented 11 years ago

Do you have ruby compiled as 32bits?

chadrem commented 11 years ago

I believe 64 bit:

$ ruby --version ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

Vasfed commented 11 years ago

cannot reproduce at the moment, will look into this a few hours later in general - it's some strange value

do you have that id(70282190736600) in partial dump?

mrb commented 11 years ago

@Vasfed Reproduced with Rails 2.3.14 and version 0.0.28

mrb commented 11 years ago
[vagrant] [10:37 AM:current(master)] $ rails_console
Loading development environment (Rails 2.3.14)
development >> HeapDump.dump
Dump should go to dump.json
machine context
global_List
starting objspace walk
RangeError: integer -3154918327658562908 too small to convert to `int'
    from /opt/src/paperlesspost/paperless-post/vendor/bundle/ruby/1.9.1/gems/heap_dump-0.0.28/lib/heap_dump.rb:10:in `dump_ext'
    from /opt/src/paperlesspost/paperless-post/vendor/bundle/ruby/1.9.1/gems/heap_dump-0.0.28/lib/heap_dump.rb:10:in `dump'
    from (irb):1
    from /usr/bin/irb:12:in `<main>'

The value in question does not appear in the resultant partial dump.

Vasfed commented 11 years ago

Still confused about exact reason for this, but above commit may help, try testing from head

chadrem commented 11 years ago

That seems to have fixed the crash! Here's the output I get now...

1.9.3p194 :001 > HeapDump.dump Dump should go to dump.json machine context global_List starting objspace walk Walker called 1342 times, seen 472096 live objects.

@Vasfed I am about to look at the dump.json to try and make sense of a memory leak I am dealing with. Thank you very much for your change and this gem.

Vasfed commented 11 years ago

@chadrem good luck :) Try using new HeapDump.count_objects, should be useful for quick finding probably leaking objects via "stare hard" method, and only then by looking into dump find why they are doing so