about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-09 15:17:02 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-09 15:25:59 -0800
commitc0813d5c3307082dcc73a930e2de218aab8be235 (patch)
treed64c78f50416d53979861dca7c9b1cc408c97002 /lib
parentd5908cae3da3b2fac66407ed1b34fb8e3f6551bb (diff)
downloadunicorn-c0813d5c3307082dcc73a930e2de218aab8be235.tar.gz
Sometimes app loads and after_fork hooks can take a long time,
even longer than shorter timeouts.  Since timeouts are only
meant for application processing when clients are involved,
we won't nuke workers that have never chmodded before.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 0f2b597..7fa8468 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -507,7 +507,10 @@ module Unicorn
     # worker.
     def murder_lazy_workers
       WORKERS.dup.each_pair do |wpid, worker|
-        (diff = (Time.now - worker.tmp.stat.ctime)) <= timeout and next
+        stat = worker.tmp.stat
+        # skip workers that disable fchmod or have never fchmod-ed
+        stat.mode == 0100600 and next
+        (diff = (Time.now - stat.ctime)) <= timeout and next
         logger.error "worker=#{worker.nr} PID:#{wpid} timeout " \
                      "(#{diff}s > #{timeout}s), killing"
         kill_worker(:KILL, wpid) # take no prisoners for timeout violations