diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-29 22:47:37 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-29 22:47:37 -0700 |
commit | 49acd52b3f67d5be433babc38a28ea6865af38a5 (patch) | |
tree | f88912153a27984177df1b6e19c3eb38361b0560 | |
parent | 2f497f7c47730522418e44d9de49ee962e47ff2e (diff) | |
download | unicorn-49acd52b3f67d5be433babc38a28ea6865af38a5.tar.gz |
If fstat() fails on an open file descriptor in the master, something is seriously wrong (like your kernel is broken/buggy) and trying to restart the worker that owned that file descriptor is likely masking the symptoms. Instead let the error propagate up to the main loop to avoid wasting cycles to restart broken workers.
-rw-r--r-- | lib/unicorn.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 7081164..ae1de59 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -471,16 +471,8 @@ module Unicorn # is stale for >timeout seconds, then we'll kill the corresponding # worker. def murder_lazy_workers - diff = stat = nil WORKERS.dup.each_pair do |wpid, worker| - stat = begin - worker.tmp.stat - rescue => e - logger.warn "worker=#{worker.nr} PID:#{wpid} stat error: #{e.inspect}" - kill_worker(:QUIT, wpid) - next - end - (diff = (Time.now - stat.ctime)) <= timeout and next + (diff = (Time.now - worker.tmp.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 |