Enabling/disabling GC manually causes rack-perftools_profiler to hang
Opened this issue · 1 comments
So I'm profiling a Rails 3.2 app on Ruby 1.9.3 which has the following filter in ApplicationController to reduce the frequency of GC runs:
@@last_gc_run = Time.now
around_filter do |c, &action|
GC.disable
rv = action.call()
if Time.now - @@last_gc_run > 1.0
GC.enable
GC.start
@@last_gc_run = Time.now
end
rv
end
Ordinarily, this makes things about 30% faster. If I hit http://mysite/controller/action
, it runs as expected, only taking a few seconds... but if I hit http://mysite/controller/action?profile=1
, it causes the Ruby process to spin up to 100% CPU usage and run forever. Doesn't respond to signals, needs to be SIGKILLed. Removing this around_filter makes ?profile=1
requests work normally again.
My configuration is { :default_printer => :text, :mode => :walltime }
, although the bug seems to occur no matter which printer I use.
Sorry, forgot to mention: this is all running on Apache 2.2 with Passenger 3.0.11.