diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-19 17:32:47 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-19 17:32:47 +0000 |
commit | fa7a9d6262c84951cbe5992e1da4269aeb3a95f7 (patch) | |
tree | ec7e4290227288690e4037ef1404025ade15ad8d | |
parent | 1c04827eae7600da1639f5bd98f55206c1cbf7b5 (diff) |
Record URL and PID *before* a request is processed
(If DEBUG_RECORD_MEMORY is enabled)
This is useful for tracking down bugs that cause Rails to go into an infinite or very long
loop, as the recent Xapian wildcard bug does.
-rw-r--r-- | app/controllers/application_controller.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c38ab594d..d3ea7493b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -89,6 +89,7 @@ class ApplicationController < ActionController::Base def record_memory record_memory = MySociety::Config.get('DEBUG_RECORD_MEMORY', false) if record_memory + logger.info "Processing request for #{request.url} with Rails process #{Process.pid}" File.read("/proc/#{Process.pid}/status").match(/VmRSS:\s+(\d+)/) rss_before_action = $1.to_i yield |