From a491174efa130fb45494f444c3f66851c035215c Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 19 Dec 2010 00:15:24 +0000 Subject: [PATCH 1/1] 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. --- config/initializers/memory_limits.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.43.2