Skip to content

ThreadError: can't be called from trap context #72

Description

@yourtallness

I'm trying to follow this guide with ruby 2.4.6 & rails 4.2.11.1.

On my locally running sidekiq instance it does not seem to work:

bundle exec rbtrace -p <pid> -e "load 'command.rb'"

I've put the following line in command.rb to work around the Mac OS line-too-long issue:

Thread.new{GC.start; require "objspace";io=File.open("/tmp/ruby-heap.dump", "w"); ObjectSpace.dump_all(output: io); io.close}

In my application.rb I have:

require 'rbtrace'
require 'objspace'
ObjectSpace.trace_object_allocations_start

Yet, the result I get is:

*** attached to process 24295
>> load 'yolo.rb'
=> #<ThreadError: can't be called from trap context>
*** detached from process 24295

Please advise how I can get around this, thanks in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions