]> git.openstreetmap.org Git - rails.git/commitdiff
Only shut down the current process when the memory limit is reached
authorTom Hughes <tom@compton.nu>
Sun, 19 Dec 2010 00:15:24 +0000 (00:15 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 19 Dec 2010 00:15:24 +0000 (00:15 +0000)
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

index e2dcee23c1a438287099317bdffbe05f7fc340f5..d3bd7a16b27627539a11a6253bf1073e82e6f98e 100644 (file)
@@ -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