From: Tom Hughes Date: Sun, 19 Dec 2010 00:15:24 +0000 (+0000) Subject: Only shut down the current process when the memory limit is reached X-Git-Tag: live~6283^2^2~31 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a491174efa130fb45494f444c3f66851c035215c?hp=a998a0bb2012a6e983eae3da9377b3669e9f24b2;ds=sidebyside Only shut down the current process when the memory limit is reached Contrary to what the ruby documentation says, sending a signal to PID 0 actually signals the whole process group, not just the current process. So use Process.pid to make sure we only signal the current process. --- diff --git a/config/initializers/memory_limits.rb b/config/initializers/memory_limits.rb index e2dcee23c..d3bd7a16b 100644 --- a/config/initializers/memory_limits.rb +++ b/config/initializers/memory_limits.rb @@ -18,7 +18,7 @@ if defined?(SOFT_MEMORY_LIMIT) and defined?(PhusionPassenger) # Restart if we've hit our memory limit if resident_size > SOFT_MEMORY_LIMIT - Process.kill("USR1", 0) + Process.kill("USR1", Process.pid) end # Return the result of this request