fluent / sigdump

Use signal to show stacktrace of a Ruby process without restarting it
Apache License 2.0
188 stars 27 forks source link

All objects: sections are not shown sometimes #6

Open sonots opened 9 years ago

sonots commented 9 years ago

The sigdump often (about 50%?) does not show all objects section.

The output of sigdump stops at Built-in objects: section as below:

      /xxxxxx/shared/bundle/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
      /xxxxxx/shared/bundle/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
  Built-in objects:
   873,884: TOTAL
   438,910: T_STRING
   255,922: T_ARRAY
    70,682: T_DATA
    59,217: T_NODE
    14,511: FREE
    11,218: T_HASH
    10,058: T_OBJECT
     6,142: T_CLASS
     2,052: T_REGEXP
     1,367: T_ICLASS
       984: T_RATIONAL
       889: T_MODULE
       816: T_STRUCT
       567: T_BIGNUM
       442: T_SYMBOL
        82: T_MATCH
        15: T_FILE
         9: T_FLOAT
         1: T_COMPLEX

I did not investigate well.

frsyuki commented 9 years ago

It doesn't reproduce on my environment. It would be great if you can investigate.

sonots commented 9 years ago

It seems that sigdump is throwing an error at https://github.com/sonots/sigdump/blob/69e2205ab5df635b277eb11ac4b0f0d1bd752a13/lib/sigdump.rb#L60

ThreadError can't be called from trap context
ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/mailbox.rb:27:in `lock'
ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/mailbox.rb:27:in `<<'
ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb:30:in `method_missing'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:60:in `block in dump_object_count'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:59:in `each_object'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:59:in `dump_object_count'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:18:in `block in dump'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:127:in `open'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:127:in `_open_dump_path'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:14:in `dump'
ruby/2.2.0/bundler/gems/sigdump-69e2205ab5df/lib/sigdump.rb:7:in `block in setup'
ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:86:in `call'
ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:86:in `select'
ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:86:in `run'
ruby/2.2.0/gems/sidekiq-3.3.4/bin/sidekiq:8:in `<top (required)>'
ruby/2.2.0/bin/sidekiq:23:in `load'
ruby/2.2.0/bin/sidekiq:23:in `<main>'
rud commented 9 years ago

This line probably makes it more difficult to debug, maybe a tiny bit of output would be helpful: https://github.com/sonots/sigdump/blob/69e2205ab5df635b277eb11ac4b0f0d1bd752a13/lib/sigdump.rb#L8