rbtrace: Cannot connect to process running in Phusion Passenger

I am trying to perform an rbtrace on a Rails app running in Phusion Passenger. If I execute a long running rake task it can connect just fine. If I connect it to the corresponding Passenger Process it tells me (pid is not listening for messages, did you require "rbtrace").

I have required rbtrace in the environment.rb. Passenger runs in production mode, and I am using REE 1.8.7. Is there any reason rbtrace would not work for a Passenger process?

About this issue

  • Original URL
  • State: open
  • Created 13 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

For anyone running into this issue, the correct way to use rbtrace with recent versions of passenger is to require it within the after_installing_signal_handlers hook:

# config.ru
PhusionPassenger.on_event(:after_installing_signal_handlers) do
  require 'rbtrace'
end

If you require it earlier, passenger resets all signal handlers after fork, which removes the SIGURG handler that rbtrace installs.

@mariogintili I switched to memory_profiler which uses ObjectSpace to profile memory per request.

It helped me pin down leaks in my application.